reoverlay
reoverlay copied to clipboard
Change properties of Modal
Consider following scenario:
const SomeComponent: FC = () => {
const {
dispatchFileAction,
files
} = useFile()
return (
<button
onClick={ (): void => {
Reoverlay.showModal(FileBrowserModal, {
files,
onFolderOpen: (file): void => {
void dispatchFileAction({
payload: file.key,
type: EFileAction.openDirectory
})
}
})
} }
type="button"
>
Toggle File Browser
</button>
)
}
How would I correctly update properties of the used modal FileBrowserModal?
Would be a static method like Reoverlay.updateProps feasable?
@InsOpDe That sounds like a good idea, but you can actually access files in FileBrowserModal component itself. You don't need to pass it as props I'm saying...
Thanks for your reply.
That might work for this particular scenario, but it is no solution you can apply to all problems