import React, { MouseEvent } from 'react'; interface Props {} interface State { info: string; } class Box2 extends React.Component { constructor(props: Props) { super(props); this.state = { info: '' }; } render() { const { info } = this.state; return (
box2
{info}
); } changeInfo() { this.setState({ info: Math.floor(Math.random() * 1000) + '' }); } } export default Box2;