Reactjs 用jest和Ezyme测试UseReactiveVar
我正在使用apollo-client-3进行状态管理。我想测试Reactjs 用jest和Ezyme测试UseReactiveVar,reactjs,jestjs,enzyme,apollo-client,Reactjs,Jestjs,Enzyme,Apollo Client,我正在使用apollo-client-3进行状态管理。我想测试useReactiveVar 这是我的密码: import { useReactiveVar } from '@apollo/client'; const showBoxVar = makeVar(false); const App: FunctionComponent = () => { const showBox = useReactiveVar(showBoxVar); return (
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>
);
}
从'@apollo/client'导入{useReactiveVar};
const showBoxVar=makeVar(false);
常量应用程序:FunctionComponent=()=>{
const showBox=useReactiveVar(showBoxVar);
返回(
{showBox&&}
);
}
我想测试一下,一旦showBox为真,Box就会呈现。怎么做