This particular article is my solution to try and mock a particular external method (using jest mock method) in the test case for a simple example app. Hope this article saves time for a lot of fellow devs in the community!
So React Portals are basically React’s way of rendering your desired component into a target dom element anywhere in your react application.
In my current company I am unit testing React components using jest and enzyme. While testing one of the functional components I came across a problem which needed a good solution/explanation and after some research on it I think I found the right way to do it and I wanted to share it with the community