Answers for "force update function component after fetch data second time"

0

force update function component after fetch data second time

**** You can simply define the useState like that ****

const [, forceUpdate] = React.useState(0);
 ==== >> And usage: forceUpdate(n => !n)
Posted by: Guest on February-15-2021
0

force update function component after fetch data second time

const [, updateState] = React.useState();
const forceUpdate = React.useCallback(() => updateState({}), []);
Posted by: Guest on February-15-2021

Code answers related to "force update function component after fetch data second time"

Code answers related to "Javascript"

Browse Popular Code Answers by Language