//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
// making all uppercase
city.toUpperCase();
//removing spaces and making all lowercase
city = city.trim().toLowerCase();
//capitalizing the first letter
cityCapitalized = city.charAt(0).toUpperCase() + city.slice(1);
Comments