ywana-core8 0.0.580 → 0.0.581

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -200,18 +200,25 @@
200
200
  sections = _props$sections === void 0 ? [] : _props$sections,
201
201
  onCheck = props.onCheck;
202
202
 
203
- var _useState = React.useState(sections.map(function (section) {
204
- return section.open;
205
- })),
203
+ var _useState = React.useState([]),
206
204
  openSections = _useState[0],
207
205
  setOpenSections = _useState[1];
208
206
 
209
- var _useState2 = React.useState(sections.map(function (section) {
210
- return section.checked;
211
- })),
207
+ var _useState2 = React.useState([]),
212
208
  checkedSections = _useState2[0],
213
209
  setCheckedSections = _useState2[1];
214
210
 
211
+ React.useEffect(function () {
212
+ var openSections = sections.map(function (section) {
213
+ return section.open;
214
+ });
215
+ var checkedSections = sections.map(function (section) {
216
+ return section.checked;
217
+ });
218
+ setOpenSections(openSections);
219
+ setCheckedSections(checkedSections);
220
+ }, [sections]);
221
+
215
222
  function toggle(index) {
216
223
  var next = openSections.map(function (open, i) {
217
224
  return i === index ? !open : open;