“Use OnChange com React Select” Respostas de código

Use OnChange com React Select

const [valueState,setValueState] = useState("")
// create a function that handle the React-select event and
// save the value of that event on an state every time the component change
    const handler = (event) => {
        const value = event.value
        setValueState(value)
    }
<Select options={"your options"} onChange={handler}/>
Johiny

manuseie o reagir de alteração

import React, { Component } from 'react';

import './App.css';
import Header from './Header';

class App extends Component {

  constructor(props) {
    super(props);
   this.state = {name: "Michael"}

  }
   changeTitle = (e) =>{
      this.setState({name: e.target.value});
    }

  render() {
    return (
      <div className="App">
        <Header title={this.state.name}/>
        <p className="App-intro">
          Type here to change name.
        <input type="text" onChange={this.changeTitle}/>
        </p>
      </div>
    );
  }
}

export default App;
Grumpy Gibbon

Respostas semelhantes a “Use OnChange com React Select”

Perguntas semelhantes a “Use OnChange com React Select”

Mais respostas relacionadas para “Use OnChange com React Select” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código