You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem with getting data from react-router-dom useParams hook #104
exportdefaultfunctionAntdSample(){return(<><Buttontype="primary"onClick={()=>NiceModal.show('my-antd-modal',{name: 'Nate'})}>
Show Modal
</Button><MyAntdModalid="my-antd-modal"{...otherProps}/></>);}
but in your example i comment this line <Modal id="my-modal"/> and use show() method <Button onClick={() => NiceModal.show(Modal)}>show modal</Button> i have problem, because i used create method for register modal, any way for this?
but in your example i comment this line <Modal id="my-modal"/> and use show() method <Button onClick={() => NiceModal.show(Modal)}>show modal</Button> i have problem, because i used create method for register modal, any way for this?
In case you want your modal to be rendered in the current context, it must be declared as a normal component and manage it by id.
Activity
duccadhv1 commentedon Feb 15, 2023
i have the same problem, any idea resolved it?
supnate commentedon Feb 15, 2023
To use the router params, plz use the declarative way:
https://opensource.ebay.com/nice-modal-react/#declarative
For example:
supnate commentedon Feb 15, 2023
See the updated codesandbox: https://codesandbox.io/s/nice-modal-useparams-bug-forked-riu9d7
duccadhv1 commentedon Feb 15, 2023
but in your example i comment this line
<Modal id="my-modal"/>and use show() method<Button onClick={() => NiceModal.show(Modal)}>show modal</Button>i have problem, because i used create method for register modal, any way for this?supnate commentedon Feb 15, 2023
In case you want your modal to be rendered in the current context, it must be declared as a normal component and manage it by id.
supnate commentedon Feb 15, 2023
An alternative way is get params in the component where you call
modal.showthen pass the parameters to the modal.ArturKustyaev commentedon Feb 20, 2023
Thanks for the reply, i appreciate it ❤