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
I am not sure if this is an issue per-say but am attempting to use this library to render a modal and have run into a situation where I am not sure on the best solution. I have a modal that contains a cancel and create button. Clicking either of these should close the modal. However, I am not sure on how to best handle this case. The show/hide functions returned from useModal coupled with needed to pass a function into the modal props (to handle closing the modal after creation) creates a circular dependency. The only way I have found to be able to do it is to pass handleClose and handleCreate func props to the modal and set their value equal to the hideModal function. This doesnt feel correct but I cant figure out another way to handle this case. Example below:
I am not sure if this is an issue per-say but am attempting to use this library to render a modal and have run into a situation where I am not sure on the best solution. I have a modal that contains a cancel and create button. Clicking either of these should close the modal. However, I am not sure on how to best handle this case. The show/hide functions returned from useModal coupled with needed to pass a function into the modal props (to handle closing the modal after creation) creates a circular dependency. The only way I have found to be able to do it is to pass handleClose and handleCreate func props to the modal and set their value equal to the hideModal function. This doesnt feel correct but I cant figure out another way to handle this case. Example below:
const [showWorkspaceModal, hideWorkspaceModal] = useModal(() => ( <CreateWorkspaceDialog open handleClose={hideWorkspaceModal} handleCreate={hideWorkspaceModal} /> ))
The text was updated successfully, but these errors were encountered: