Skip to content

Commit

Permalink
fix: check if empty on create element
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Cesarato committed Jun 7, 2021
1 parent acada01 commit 01885b9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,11 @@ export const mergeViewStyle = (style, defaultStyle) => {
* @returns {JSX.Element|[]|*}
*/
export const createElement = (Component) => {
return React.isValidElement(Component) ? Component : <Component />;
return Component != null ? (
React.isValidElement(Component) ? (
Component
) : (
<Component />
)
) : null;
};

0 comments on commit 01885b9

Please sign in to comment.