This repository has been archived by the owner on May 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
83 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Ciclo from "./componentes/Ciclo"; | ||
|
||
function App(){ | ||
return( | ||
<> | ||
<Ciclo /> | ||
</> | ||
) | ||
} | ||
|
||
export default App; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React,{ Component } from "react"; | ||
|
||
|
||
class Ciclo extends Component{ | ||
constructor(props){ | ||
super(props); | ||
this.state = { | ||
valor: 0 | ||
} | ||
} | ||
|
||
componentDidMount(){ | ||
this.setState({ | ||
valor: 1 | ||
}) | ||
} | ||
|
||
render(){ | ||
return( | ||
<section> | ||
<h1>Ciclo de vida</h1> | ||
<p>{this.state.valor}</p> | ||
<button onClick={ | ||
() => this.setState({ | ||
valor: this.state.valor+1 | ||
}) | ||
}>+1</button> | ||
</section> | ||
) | ||
} | ||
} | ||
|
||
export default Ciclo; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Vida do Componente | ||
|
||
Montagem | ||
|
||
constructor(); | ||
render(); | ||
componentDidMount(); | ||
|
||
Atualização | ||
|
||
render(); | ||
componentDidUpdate(); | ||
|
||
Desmontagem | ||
|
||
componentWillUnmount(); | ||
|
||
▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲ | ||
▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼▲▼ | ||
|
||
constructor() | ||
Não podemos usar setState no Constructor. | ||
|
||
render() | ||
Único método obrigatório da classe, deve retornar o que | ||
queremos mostrar na tela. | ||
|
||
componentDidMount() | ||
Set state pode ser aplicado nessa fase. | ||
|
||
componentDidUpdate() | ||
Gera um loop se usarmos um setState. | ||
|
||
componentWillUnmount() | ||
Podemos usamar para limpar timers etc antes do componente ser | ||
destruido. |