Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

62
Visualizações
Change state with Form.Range onChange

New to React Native and JS as a whole. I'm trying to learn to set state and work with classes. How do I set value to the changed value of the <RangeSlider> component?

Getting this error: ReferenceError: value is not defined

Thanks for the help in advance and apologies for the noob question. If I could get a description or explanation on different ways to handle the scope of variables as well and the manipulation that would be appreciated.

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: 0
    };
  }

  render() {
    return(
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Form>
          <Form.Group>
            <Form.Label>
              Mood
            </Form.Label>
              <RangeSlider
                value={this.state.value}
                onChange={this.setState(value)}
                min={1}
                max={5}/>
          </Form.Group>
        </Form>
      </View>
    );
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When you do setState, you have to pass in an object, and when you have an onChange you need to pass a function, so you probably want either

onChange={(e) => this.setState({value: e.target.value})}

or

onChange={(value) => this.setState({value})}

depending on what RangeSlider returns in it's onChange function (the event or just the value) and you should be good to go

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda