You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to use HOCs which sent down some classnames like so:
The styleName in withWarning.js resolves from loader to a class name which will be passed down. Here assume the resolved className is withWarning__warning__er3432
// withWarning.jsimport'styles.scss';// has inside a class .warningexportdefaultComponent=>({warning, ...props})=>{letstyleNames='';if(warning){styleNames='warning';}return<Component{...props}styleName={styleNames}/>;};
At prettyText.js the styleName resolves as prettyText__pretty__ty3342. At the same time the component received as a property className which previously resolved withWarning__warning__er3432. Instead of merging these two classes on the final outcome, only the resolved from styleName is being used and the className from props never gets concatenated unless someone would explicitly declare the className on JSX <div {...props} className={props.className} styleName='pretty' />.
// /prettyText.jsimportwithWarningfrom'./withWarning';import'styles.scss';// has inside a class .prettyconstText=props=>{return<div{...props}styleName='pretty'/>;};exportdefaultwithWarning(Text);
We want to use HOCs which sent down some classnames like so:
The styleName in
withWarning.js
resolves from loader to a class name which will be passed down. Here assume the resolved className iswithWarning__warning__er3432
At
prettyText.js
the styleName resolves asprettyText__pretty__ty3342
. At the same time the component received as a propertyclassName
which previously resolvedwithWarning__warning__er3432
. Instead of merging these two classes on the final outcome, only the resolved from styleName is being used and the className from props never gets concatenated unless someone would explicitly declare theclassName
on JSX<div {...props} className={props.className} styleName='pretty' />
.Ending up with something like so:
The text was updated successfully, but these errors were encountered: