0

On a button click a new window should be opened and on that window I'm trying to display a separate JSX component. Kinda like flipping to the next page on a book. I have searched for hours only finding antiquated answer's. I just need some guidance any help is appreciated. Below is the code:

onClick() {
window.open()
    }

EDIT: I am working in visual studio code and testing my create-react-app on port 3000.

EDIT: My question is very similar to this

JavaHava
  • 189
  • 2
  • 15
  • If the JSX in the new tab is in a separate React app at a different url... sure. Otherwise, your question does not make a lot of sense. – BugsArePeopleToo Jun 25 '19 at 17:01
  • Ok i'll rephrase it – JavaHava Jun 25 '19 at 17:02
  • 1
    Possible duplicate of [Open a component in new window on a click in react](https://stackoverflow.com/questions/47574490/open-a-component-in-new-window-on-a-click-in-react) –  Jun 25 '19 at 17:09
  • I tried these methods and none worked – JavaHava Jun 25 '19 at 17:12
  • Did you tried the npm package that is specifically for this case? Check this out if you haven't: https://www.npmjs.com/package/react-new-window –  Jun 25 '19 at 17:18
  • Yes but you can't assign the window on a button click that was my main issues with importing that npm – JavaHava Jun 25 '19 at 17:22

0 Answers0