this is my project code:
const [ipData, setIpData] = React.useState();
const [operationsLoader, setOperationsLoader] = React.useState(true);
const [operations, setOperations] = React.useState();
const [toRender, setToRender] = useState(false);
const [modalOpen, setModalOpen] = useState(false);
const [loaded, setLoaded] = React.useState(false);
const [allowed, setAllowed] = React.useState(false);
const tableRef = React.createRef();
and the component returing the html ,when loaded and allowed are set to true, by doing this and changing these states in my testcase, i am getting error:
Should have a queue. This is likely a bug in React. Please file an issue.
84 | const [operations, setOperations] = React.useState([]);
85 |
> 86 | const [toRender, setToRender] = useState(false);
| ^
87 | const [modalOpen, setModalOpen] = useState(false);
this is the code:
const useStateSpy = jest.spyOn(React, ‘useState’);
const setLoadingMock = jest.fn();
useStateSpy.mockImplementationOnce((loaded) => [loaded=“true”, setLoadingMock]);
useStateSpy.mockImplementationOnce((allowed) => [allowed=“true”, setLoadingMock]);
1 post - 1 participant