Last active
August 22, 2020 02:22
-
-
Save diego-miranda-ng/5f40f200d025e8a284b205eda8b03d21 to your computer and use it in GitHub Desktop.
Exemplo da utilização do hook useState para lidar com um estado armazenando um objeto em um componente de função.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
export default App = (props) => { | |
const p = { name: "Nome da pessoa", age: 24 }; | |
const [person, setPerson] = useState(p); | |
return <span>{`${person.name} - ${person.age}`}</span>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment