You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
InternshipProject/node_modules/antd/es/_util/hooks/useSyncState.js

13 lines
353 B

import * as React from 'react';
import useForceUpdate from './useForceUpdate';
export default function useSyncState(initialValue) {
var ref = React.useRef(initialValue);
var forceUpdate = useForceUpdate();
return [function () {
return ref.current;
}, function (newValue) {
ref.current = newValue; // re-render
forceUpdate();
}];
}