Passing params
Thanks to React, we can reuse the same component over and over again. You might want to do the same thing with your modals: calling different modals, but rendering the same React component under the hood. Being able to know in which context that component was called is a major key to success, hence the params
!
They are a two-step-use tool:
Passing params to a modal by putting them in an object as
modal.openModal
second parameter:openModal('Error', { /* put params here */})
Accessing the params in your modal component:
modal.params
.
Last updated