There is such a React component:
import React from 'react'; import './AppSearch.css' class AppSearch extends React.Component { constructor() { super(); this.state = { request: '', } this.onSearch = (e) => { this.setState({ request: e.target.value, }) console.log(this.state.request); } } render () { return( <input className='AppSearch' value={this.state.request} onChange={ this.onSearch } placeholder = 'Search parametr' /> ) } }; export default AppSearch; For some reason, the onChange event does not work correctly. I can not figure out why.
The onSearch function first changes the request , and then only outputs this value, but it turns out as if it works the other way around:
The screenshot shows that I entered three deuces, and there are only two in the console. With what it can be connected?
