force update function component after fetch data second time code example
Example 1: force update function component after fetch data second time
const [, updateState] = React.useState();
const forceUpdate = React.useCallback(() => updateState({}), []);
Example 2: 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)