Closed gpittarelli closed 5 years ago
The following is valid React:
const props = null; <div {...props} styleName='a' />;
On master, after https://github.com/gajus/babel-plugin-react-css-modules/pull/243, this compiles to:
const props = null; <div {...props} className={"foo__a" + (" " + (props.className || ""))} />;
However, this fails because it is trying to read the className property of null.
className
null
This PR fixes this (and updates the tests) by also compiling in a falsy-check around props:
props
const props = null; <div {...props} className={"foo__a" + (" " + (props ? props.className || "" : ""))} />;
:tada: This PR is included in version 5.2.4 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thanks!
The following is valid React:
On master, after https://github.com/gajus/babel-plugin-react-css-modules/pull/243, this compiles to:
However, this fails because it is trying to read the
className
property ofnull
.This PR fixes this (and updates the tests) by also compiling in a falsy-check around
props
: