-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with getting data from react-router-dom useParams hook #104
Comments
i have the same problem, any idea resolved it? |
To use the router params, plz use the declarative way: For example: export default function AntdSample() {
return (
<>
<Button type="primary" onClick={() => NiceModal.show('my-antd-modal', { name: 'Nate' })}>
Show Modal
</Button>
<MyAntdModal id="my-antd-modal" {...otherProps} />
</>
);
} |
See the updated codesandbox: https://codesandbox.io/s/nice-modal-useparams-bug-forked-riu9d7 |
but in your example i comment this line |
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. |
An alternative way is get params in the component where you call |
Thanks for the reply, i appreciate it ❤ |
Can't get data from react-router-dom useParams hook using it inside NiceModal.create() function.
CodeSandbox: https://codesandbox.io/s/nice-modal-useparams-bug-dm3qz8
The text was updated successfully, but these errors were encountered: