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

290
Views
How to move a React component to a new Window

I have very complex component which takes long time to render, and I want this component shown in a child Window (created by Window.open()) once the user clicks a button.

So, I'd like to pre-render this component in the main window first, then, just move the rendered component into the child window on button click, which could improve the performance since everything has been rendered.

Below is the component that I want to pre-render which might have some sub components:

export default observer(function MyComp(props: MyCompProps) {
    ...
    return (
        <div>Some complex sub components</div>
    );
});

I am wondering if there is a way to do that. Any suggestion would be appreciated.

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

0

Remember that React has a rule, all components must have the first capital letter.

About your doubt, you can use the useState() hook to set the component's value to false and only when you click on the button it opens inside the window you want.

export default observer(function MyComp(props: MyCompProps) {
    const [isOpenComponent, setIsOpenComponent] = useState(false);

function handleOpen() {
  setIsOpenComponent(true);
}
    return (
        <div>
         <div>Some complex sub components</div>
          <div isOpenComponent> Component that you want to open</div>
          <button type="button" onClick={handleOpen}>Open Component</div>
         </div>
        </div>
    );
});

This is only an idea to implement your case.

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!