Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Removing an external component on click of button

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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')
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!