📌  相关文章
📜  为什么要使用 event.persist - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:15.435000             🧑  作者: Mango

代码示例2
//Without event.persist() , 
//React will make the first event value as null when second event is fired.

//How to use?

const handleFilterChange = (event) => {
    event.persist();
    setFilters(currentFilters => (
      produce(currentFilters, draftFilter => {
        draftFilter[event.target.name] = event.target.value;
      })
    ))
  };