Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - onChange events

0 votes
10 views
added Dec 6, 2021 in React by lcjr Second Warrant Officer (6,570 points)
constructor(props) {
    super(props);
    this.state = {
      key: 1,
      project: '',
      buildingtypeselect: '',
      buildingtypesdata: [],
      tenure: '',
      lotsize: '',
      poInfo: '',
    }; 
    this.handleCategoryChange = this.handleCategoryChange.bind(this);
  }
  
handleCategoryChange = event => {
  const categoryURL = `/location-scan?category=${event.target.value}`
  Router.push(categoryURL);
  this.setState({
    category: event.target.value,
  });
};
  
<div className="col-3">
  <select
    value={category}
    onChange={this.handleCategoryChange}
    className="form-control table-row custom-select"
  >
    <option value="RESIDENTIAL">RESIDENTIAL</option>
    <option value="COMMERCIAL">COMMERCIAL</option>
    <option value="INDUSTRIAL">INDUSTRIAL</option>
  </select>
</div>

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...