-
Notifications
You must be signed in to change notification settings - Fork 907
Open
Labels
enhancementNew feature or requestNew feature or requesttriageAwaiting initial review and prioritizationAwaiting initial review and prioritizationv4#4488#4488
Description
Package
v4.x
Description
Modals which have presentation responsibility will emits events to make the host change its state or behave with http requests, and so and so update props.
useOverlay could help to listen emit events by defining them on create method.
Instead of:
const myModal = overlay.create(MyModalComponent);
myModal.open({
myProps,
onClose: myModal.close,
onDelete: handleDelete,
});
Doing this:
const myModal = overlay.create(
MyModalComponent,
);
myModal.on('close', myModal.close);
myModal.on('delete', handleDelete);
// OR
myModal.on({
close: myModal.close,
delete: handleDelete
});
// ...
myModal.open({
myProps,
});
Simple alternative would permits partial props on second create method argument (which currently waits for all required props).
One another idea about this alternative is that all required props assigned on create would be set as optional on the open method as it's been already defined. This could be helpful for static props.
Additional context
I use useOverlay with a modal which don't have inner state except props.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesttriageAwaiting initial review and prioritizationAwaiting initial review and prioritizationv4#4488#4488