Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react button onclick components

function Button(){
  const [counter , setCounter] = useState(0);
  return <button onClick={() => setCounter(counter+1)}>{counter}</button>
}
ReactDOM.render(
<Button />,
document.getElementById('mountNode'),
  );
Source by jscomplete.com #
 
PREVIOUS NEXT
Tagged: #react #button #onclick #components
ADD COMMENT
Topic
Name
2+4 =