react avoid spreading non dom props across component

Solutions on MaxInterview for react avoid spreading non dom props across component by the best coders in the world

showing results for - "react avoid spreading non dom props across component"
Cameron
09 Nov 2018
1function MyDiv(props) {
2
3  const divProps = Object.assign({}, props);
4  delete divProps.layout;
5
6  if (props.layout === 'horizontal') {
7    return <div {...divProps} style={getHorizontalStyle()} />
8  } else {
9    return <div {...divProps} style={getVerticalStyle()} />
10  }
11}
similar questions