Closed acgblogs closed 2 years ago
<==== my code ====> const Example = () => { const [referenceElement, setReferenceElement] = React.useState(null); const [popperElement, setPopperElement] = React.useState(null); const { styles, attributes } = usePopper(referenceElement, popperElement, { placement: 'top' });
return ( <> <button type="button" ref={setReferenceElement}> Reference </button> {ReactDOM.createPortal( <div ref={setPopperElement} style={styles.popper} {...attributes.popper} > Popper </div>, document.body )} </> );
};
<==== popper render result ===>
package version: "@popperjs/core": "^2.11.5", "react-popper": "^2.2.5"
<==== my code ====> const Example = () => { const [referenceElement, setReferenceElement] = React.useState(null); const [popperElement, setPopperElement] = React.useState(null); const { styles, attributes } = usePopper(referenceElement, popperElement, { placement: 'top' });
};
<==== popper render result ===>![image](https://user-images.githubusercontent.com/79389581/165473900-92c71bfb-0fee-456e-8416-b9632cae6229.png)