I am new to React. I have the following components in the index.js React DOM area
ReactDOM.render(
<React.StrictMode>
<NavigationBar />
<App />
<Login />
</React.StrictMode>,
document.getElementById('root')
);
The NavigationBar was created using Bootstrap and when I click on the search button, I wanted the component to be removed and replaced by the component.
How do I do it?
you need to use useState : when you clicked on button you need to change the state with onChange
const [check, setCheck] = useState(false);
ReactDOM.render(
<React.StrictMode>
<NavigationBar />
{check ? <App /> : anotherCoponent you want}
<Login />
</React.StrictMode>,
document.getElementById('root')
);