first commit
This commit is contained in:
11
frontend/node_modules/antd/es/_util/hooks/useSyncState.js
generated
vendored
Normal file
11
frontend/node_modules/antd/es/_util/hooks/useSyncState.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { useForceUpdate } from './useForceUpdate';
|
||||
export const useSyncState = initialValue => {
|
||||
const ref = React.useRef(initialValue);
|
||||
const [, forceUpdate] = useForceUpdate();
|
||||
return [() => ref.current, newValue => {
|
||||
ref.current = newValue;
|
||||
// re-render
|
||||
forceUpdate();
|
||||
}];
|
||||
};
|
||||
Reference in New Issue
Block a user