Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

64
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!