mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-20 04:01:32 -04:00
* fix: replace sh with shell fix replace terminal with shell fix replace node with js fix replace output with shell fix replace cs with csharp fix replace c++ with cpp fix replace c# with csharp fix replace javasctipt with js fix replace syntax with js fix replace unix with shell fix replace linux with shell fix replace java 8 with java fix replace swift4 with swift fix replace react.js with jsx fix replace javascriot with js fix replace javacsript with js fix replace c++ - with cpp fix: corrected various typos fix: replace Algorithm with nothing fix: replace xaml with xml fix: replace solidity with nothing fix: replace c++ with cpp fix: replace txt with shell fix: replace code with json and css fix: replace console with shell
829 B
829 B
title, localeTitle
| title | localeTitle |
|---|---|
| Render Conditionally from Props | Procesamiento condicional de apoyos |
Procesamiento condicional de apoyos
Este es un reto un poco complicado pero fácil.
Solución
Cambie handleClick() con la declaración de incremento adecuada.
handleClick() {
this.setState({
counter: this.state.counter + 1
});
}
En render() el uso del método Math.random() como se menciona en la descripción desafío y escribir una expresión ternaria para pasar props en el componente de Resultados.
let expression = Math.random() > .5;
{(expression == 1)? <Results fiftyFifty="You win!"/> : <Results fiftyFifty="You lose!"/> }
Luego renderiza los fiftyFifty apoyos en el componente Resultados.
<h1>
{
this.props.fiftyFifty
}
</h1>