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
> _Basic example: click on "Show modal" button will execute `setModalConfig` with the config we defined_.
95
103
104
+
### Advanced
105
+
106
+
#### **Update** current config **partially**
107
+
108
+
_Maybe you want to update only part of current `modalConfig`, let's say we have an open modal and we would like to change part of it's content when the user presses one of it's buttons. We can achieve this by using the functino `updateModalConfig` returned by the hook like so_
"Content message of the modal inside a component of your choice",
120
+
buttons: [
121
+
{
122
+
text:"Cancel",
123
+
},
124
+
{
125
+
text:"Confirm",
126
+
disableClose:true,
127
+
onClick: showSecondModal,
128
+
},
129
+
],
130
+
});
131
+
132
+
constshowSecondModal= () => {
133
+
updateModalConfig({
134
+
title:"I'm the second modal",
135
+
children:
136
+
"Are you sure you want to proceed?",
137
+
buttons: [
138
+
{
139
+
text:"Yes, I am!",
140
+
},
141
+
],
142
+
});
143
+
}
144
+
145
+
146
+
// ... same jsx content as seen above
147
+
148
+
};
149
+
```
150
+
151
+
_Here we've added a second button, the cancel button simply abort the operation closing the modal (so has no need for additional handlers, the confirm button is stopped from closing the modal, we pass it a handler which calls `updteModalConfig` from the hook and we update with it only the parts of the config that we need._
0 commit comments