【发布时间】:2021-07-06 02:33:17
【问题描述】:
我正在使用 apollo-client-3 进行状态管理。我要测试useReactiveVar。
这是我的代码:
import { useReactiveVar } from '@apollo/client';
const showBoxVar = makeVar(false);
const App: FunctionComponent = () => {
const showBox = useReactiveVar(showBoxVar);
return (
<React.Fragment>
{showBox && <Box/> }
<SomeComponent />
</React.Fragment>
);
}
我想测试一下,一旦 showBox 为真,Box 就会渲染。该怎么做?
【问题讨论】:
标签: reactjs jestjs enzyme apollo-client