All files utils.js

80% Statements 4/5
75% Branches 6/8
100% Functions 1/1
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15            10x     10x 2x   10x    
// @flow
import React from 'react';
import type {Element as ReactElement} from 'react';
 
// React.addons.cloneWithProps look-alike that merges style & className.
export function cloneElement(element: ReactElement<any>, props: Object): ReactElement<any> {
  Iif (props.style && element.props.style) {
    props.style = {...element.props.style, ...props.style};
  }
  if (props.className && element.props.className) {
    props.className = `${element.props.className} ${props.className}`;
  }
  return React.cloneElement(element, props);
}