(cherry picked from commit fadf72dd34)
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
This commit is contained in:
co-authored by
Hugo Häggmark
parent
28f85570a1
commit
808ffb0d51
@@ -2,6 +2,6 @@ import { useState } from 'react';
|
|||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
export function useForceUpdate() {
|
export function useForceUpdate() {
|
||||||
const [value, setValue] = useState(0); // integer state
|
const [_, setValue] = useState(0); // integer state
|
||||||
return () => setValue(value + 1); // update the state to force render
|
return () => setValue((prevState) => prevState + 1); // update the state to force render
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user