Skip to content

Commit f0fd216

Browse files
committed
Update readme.
1 parent ce12eca commit f0fd216

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,23 @@ In the example, the `onOk` property will override the result from `antdModal` he
409409
## API Reference
410410
https://ebay.github.io/nice-modal-react/api/
411411

412+
## FAQ
413+
### Can I get context in the component tree in a modal?
414+
Yes. To get the data from context in the component tree you need to use the declarative way. For example:
415+
```jsx
416+
export default function AntdSample() {
417+
return (
418+
<>
419+
<Button type="primary" onClick={() => NiceModal.show('my-antd-modal', { name: 'Nate' })}>
420+
Show Modal
421+
</Button>
422+
<MyAntdModal id="my-antd-modal" {...otherProps} />
423+
</>
424+
);
425+
}
426+
```
427+
See more [here](https://github.com/eBay/nice-modal-react/issues/104).
428+
412429
## Testing
413430

414431
You can test your nice modals with tools like `@testing-library/react`.

0 commit comments

Comments
 (0)