export function getChildMapping()

in src/utils/ChildMapping.js [9:20]


export function getChildMapping(children, mapFn) {
  let mapper = (child) =>
    mapFn && isValidElement(child) ? mapFn(child) : child;

  let result = Object.create(null);
  if (children)
    Children.map(children, (c) => c).forEach((child) => {
      // run the map function here instead so that the key is the computed one
      result[child.key] = mapper(child);
    });
  return result;
}