const App = () => {
const [loading, setLoading] = React.useState(true);
React.useEffect(() => {
const interval = setInterval(() => {
setLoading(false);
}, 3000);
return () => clearInterval(interval);
}, []);
return (
<div className="App">{loading ? <h1>Loading</h1> : <h2>Counter</h2>}</div>
);
}
ReactDOM.render(<App />, document.getElementById("root"));