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.
17 lines
479 B
17 lines
479 B
/* eslint-disable react-hooks/rules-of-hooks */
|
|
import * as React from 'react';
|
|
import { isBrowserClient } from '../utils/commonUtil';
|
|
/**
|
|
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
|
*/
|
|
|
|
export default function useLayoutEffect(effect, deps) {
|
|
// Never happen in test env
|
|
if (isBrowserClient) {
|
|
/* istanbul ignore next */
|
|
React.useLayoutEffect(effect, deps);
|
|
} else {
|
|
React.useEffect(effect, deps);
|
|
}
|
|
}
|
|
/* eslint-enable */ |