React

PHOTO EMBED

Tue Aug 23 2022 02:22:36 GMT+0000 (Coordinated Universal Time)

Saved by @forjessicasake #react.js

//Import the useState hook
import {useState} from 'react';

function App(){

//Define the state
  const [name, setName] = useState('Stephanie')
  const [color, setColor] = useState('Blue')
  
//Update the state
  const handleChange =()=>{
    setName('Bryan')
    setColor('red')
  }

  return(
    <section className = 'app'>
    <p>Hi I'm {name} and my favourite color is {color}</p>
    <button onClick ={handleChange}>Click me </button>
    </section>
  )
}

export default App
content_copyCOPY