I'm building a React app using Dart SASS. Things are generally going well and I particularly appreciate how the styles for each component are isolated to that component - ie. ComponentName.module.scss
But I've just built a new Modal component that is merely a wrapper for the popular react-modal
component installable via npm.
What I'd ideally like to be able to do is pass in a className
string that is merely a reference to an SCSS class in my parent component and have it override the default styles in Modal.jsx
.
Example: I have a component called SignIn.jsx
. It has a Forgot Password
link that, when clicked, displays a modal to allow the user to enter their email address. What would be ideal is to be able to define an SCSS class in SignIn.module.scss
and then pass into Modal.jsx
this class when I call <Modal className={...myCustomClass} ... />
I actually have been able to accomplish this with a global SCSS class definition but haven't been able to figure out how to do so as I described above.
Is what I'm seeking to do possible? Are there any articles on how to do this?