I'm not sure if this is the right way to build React components.
I have a component with several buttons that call different functions in the component. In some of the functions I need to display some extra GUI (inputs, etc.). In vanilla JS I could just do this by creating the elements (
document.createElement….) and add them to the DOM/remove them once they're not needed any more.
However in React I can't find a way to do this (of course, I could break out of the "React prison" and just create what I need and add it manually to the DOM).
I have solved this in a way I don't like today. I'm creating everything I need in the render function and hide or show it based on some props/session state variable.
I'm trying to create something like modal dialogs and I don't want to navigate to some other component.
What would be the correct way to do this?