I'm trying to convert an existing react class to a functional component. I understand that functions use the useState() function rather than setState() like in a class. How would I convert this piece of code that handles the change of any input into a functional piece?
handleChange = (input) => (e) => { this.setState({ [input]: e.target.value }); }; https://stackoverflow.com/questions/66466089/how-do-i-convert-an-any-handlechange-function-from-class-to-functional-compone March 04, 2021 at 06:46AM
没有评论:
发表评论