Answers for "onclick state change"

0

onclick state change

import React, { useState } from 'react';
import './App.css';

function App() {
  const [state, setstate] = useState("halwa");
  const content = () => setstate("halwa2");
  return (
    <div>
      <h1>{state}</h1>
      <button onClick={content}>change</button>
    </div>
  )
}

export default App
Posted by: Guest on September-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language