const SearchBar = createReactClass({
getInitialState: () => {
return { term: '' };
},
render: () => {
return (
<div>
<input
onChange={event => this.setState({ term: event.target.value })}
/>
</div>
);
}
});
This gives me an error: "Cannot read property 'setState' of undefined" What did I do wrong?
I'm trying to use react in a more functional way. Is there any other way to this by the way? Preferably without using the keyword "this"?