Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

19 строки
491 B

  1. import React from 'react';
  2. import { isFragment } from 'react-is';
  3. export default function toArray(children) {
  4. var ret = [];
  5. React.Children.forEach(children, function (child) {
  6. if (child === undefined || child === null) {
  7. return;
  8. }
  9. if (Array.isArray(child)) {
  10. ret = ret.concat(toArray(child));
  11. } else if (isFragment(child) && child.props) {
  12. ret = ret.concat(toArray(child.props.children));
  13. } else {
  14. ret.push(child);
  15. }
  16. });
  17. return ret;
  18. }