Relative Content

Tag Archive for reactjshook

why can i do early return when its not allowed in react?

import React,{useState} from ‘react’; function Car() { const [count, setCount] = useState(0); return <h2>a Car!</h2>; } export function App(props) { const [count, setCount] = useState(0); if(count===3) return ; let b=<Car/> return ( <div className=’App’> <Car/> <button onClick={() => setCount(count + 1)}> Click me {count} </button> </div> ); } when rendering app usestate at top level […]