function Button() {
const [counter, setCounter] = useState(2);
const handleClick = ()=> setCounter(counter*2);
return (
<button onClick={handleClick}>
{counter}
</button>
);
}
function Display(){
return(
<div>....</div>);
}
ReactDOM.render(
<div>
<Button />
<Display />
</div>,
document.getElementById('mountNode')
);