https://reactjs.org/docs/test-renderer.html#ideas demonstrates how to use createNodeMock to mock a callback ref. However, this example does not work for refs create with React.createRef(), because they use the current property. Could you extend the documentation please?
Need this badly, impossible to test components without it in TypeScript since we pretty much need to use React.createRef().
@Awem Did you come up with a solution?
Hi, is there any solution or alternative for this? Could be really useful.
I managed to test my component using Enzyme. Sadly i could not make it with react-test-renderer
Hi, I am actually not using createNodeMock anymore. Instead, I refactored the tested component to use the useRef hook. That works quite fine. I don't need mocks anymore.
Most helpful comment
Need this badly, impossible to test components without it in TypeScript since we pretty much need to use
React.createRef().@Awem Did you come up with a solution?