A customizable component that opens a new window using the window.open API
npm install react-window-opennpm i react-window-open
javascript
import React, { useState } from 'react'
import { NewWindow } from 'react-window-open'
const Example = () => {
const [isOpen, setIsOpen] = useState(false)
const [counter, setCounter] = useState(0)
return (
<>
{isOpen && setIsOpen(false)}>
This text is displayed in a new window. 👀
And all the states are shared ! 👌
Counter in the new window : {counter}
}
Counter on the original page : {counter}
>
)
}
export default Example
``