1 handleClick(event) {
2 event.persist();
3 this.setState((prevState) => ({
4 foo: prevState.foo + event.pageX
5 }));
6 }
1//Without event.persist() ,
2//React will make the first event value as null when second event is fired.
3
4//How to use?
5
6const handleFilterChange = (event) => {
7 event.persist();
8 setFilters(currentFilters => (
9 produce(currentFilters, draftFilter => {
10 draftFilter[event.target.name] = event.target.value;
11 })
12 ))
13 };