import React from 'react';

const Page = ({ dispatch, loading, children, localCfg, remoteCfg, id }) => {
  // console.log(localCfg);
  // const newCfg

  const childrenWithProps = React.Children.map(children, (child) => {
    //console.log(child);
    //if(remoteCfg) return 0;
    return React.cloneElement(child, { localCfg, remoteCfg: remoteCfg.panels.find(p => p.panelId === child.props.id) });
  });

  return (
    <div>
      {childrenWithProps}
    </div>
  );
};

export default Page;
