Remove useMutationEffect (#31013)

https://github.com/facebook/react/pull/14336
This commit is contained in:
Jessica Franco
2018-12-03 17:12:08 +00:00
committed by John Reilly
parent ead110d5f4
commit 3c3c8d08c4
2 changed files with 1 additions and 14 deletions
-11
View File
@@ -834,17 +834,6 @@ declare namespace React {
*/
// TODO (TypeScript 3.0): <T extends unknown>
function useRef<T>(initialValue: T|null): RefObject<T>;
/**
* The signature is identical to `useEffect`, but it fires synchronously during the same phase that
* React performs its DOM mutations, before sibling components have been updated. Use this to perform
* custom DOM mutations.
*
* Prefer the standard `useEffect` when possible to avoid blocking visual updates.
*
* @version experimental
* @see https://reactjs.org/docs/hooks-reference.html#usemutationeffect
*/
function useMutationEffect(effect: EffectCallback, inputs?: InputIdentityList): void;
/**
* The signature is identical to `useEffect`, but it fires synchronously after all DOM mutations.
* Use this to read layout from the DOM and synchronously re-render. Updates scheduled inside
+1 -3
View File
@@ -95,11 +95,9 @@ function useEveryHook(ref: React.Ref<{ id: number }>|undefined): () => boolean {
// $ExpectError
React.useImperativeMethods(ref, () => ({}), [id]);
React.useMutationEffect(() => {
React.useLayoutEffect(() => {
setState(1);
setState(prevState => prevState - 1);
}, []);
React.useLayoutEffect(() => {
didLayout.current = true;
}, []);
React.useEffect(() => {