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 ));