v6.0.35

use-force-update

Force component to render without state change
Import

Usage

use-force-update returns a function, which when called rerenders the component:

asuikit-6ukvan6sy
import { Button, Text, Group } from '@asuikit/core';
import { useForceUpdate, randomId } from '@asuikit/hooks';
function Demo() {
const forceUpdate = useForceUpdate();
return (
<Group position="center">
<Text>{randomId()}</Text>
<Button onClick={forceUpdate}>Force update</Button>
</Group>
);
}

Definition

function useForceUpdate(): () => void;