Skip to content

Commit

Permalink
Bug fixing in HTML element
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed Mar 27, 2019
1 parent ce6e9f5 commit 113e499
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/Elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import withTemplating from './withTemplating';
export const Elements = {};

HTML_TAGS.forEach(tag => {
const Fn = props => React.createElement(tag, props);
const Fn = props => {
const { $if, $else, $switch, $case, ...restProps } = props;
return React.createElement(tag, restProps);
};
const Tag = capitalCase(tag);
Fn.displayName = Tag;
Elements[Tag] = withTemplating(Fn);
Expand All @@ -15,4 +18,4 @@ function capitalCase(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}

export default { ...Elements };
export default { ...Elements };

0 comments on commit 113e499

Please sign in to comment.