showing results for - "setting react state with produce immer"
María
23 Jun 2018
1//Initialising State
2const [filters, setFilters] = useState({});
3
4
5//Setting State
6
7setFilters((filters) => (
8        produce(filters, draftFilters => {
9          if (param[0] === 'page') {
10            draftFilters.page = parseInt(param[1], 10)
11          }
12          if (param[0] === 'per_page') {
13            draftFilters.perPage = parseInt(param[1], 10)
14          }
15        })
16      ));
similar questions
queries leading to this page
setting react state with produce immer