mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-03 12:17:20 +02:00
fix(theme-common): prepare usage of useSyncExternalStore compatibility with React 18 (#8618)
This commit is contained in:
parent
1bff83cacc
commit
140f0b1d4c
1 changed files with 5 additions and 1 deletions
|
@ -56,7 +56,11 @@ export function useHistorySelector<Value>(
|
||||||
selector: (history: History<unknown>) => Value,
|
selector: (history: History<unknown>) => Value,
|
||||||
): Value {
|
): Value {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
return useSyncExternalStore(history.listen, () => selector(history));
|
return useSyncExternalStore(
|
||||||
|
history.listen,
|
||||||
|
() => selector(history),
|
||||||
|
() => selector(history),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue