Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

hide and show on button click in react js functional component

const [show,setShow]=useState(true)
  return (
    <div className="App">
     {
       show?<h1>Hello World !</h1>:null
     }
      <button onClick={()=>setShow(true)} >Show</button>
     <button onClick={()=>setShow(false)} >Hide</button> 
    </div>
  );
 
PREVIOUS NEXT
Tagged: #hide #show #button #click #react #js #functional #component
ADD COMMENT
Topic
Name
6+4 =