Skip to content

Commit

Permalink
JSX do not support dynamic tagname or component
Browse files Browse the repository at this point in the history
  • Loading branch information
Dafrok committed Jun 27, 2019
1 parent f8b12cd commit 84781ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/flex/flex_item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ import PropTypes from 'prop-types';
*/
const FlexItem = (props) => {
const { component, children, ...others } = props;
return (
<component className="weui-flex__item" {...others}>
{ children }
</component>
return React.createElement(
component,
{
className: 'weui-flex__item',
...others
},
children
);
};

Expand Down

0 comments on commit 84781ef

Please sign in to comment.