gajus / gajus/babel-plugin-react-css-modules

What is the best way of handling conditional styles together with this plugin?

Open
#253 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

First off, thanks you for this amazing library. It solves a huge problem and really cleans up my code. I know it's a matter of opinion but I'm curious what the most idiomatic / readable / cleanest way to handle conditional styles together with this plugin? Here's my current approach with a functional component. Does anyone have any other patterns?

```
import React from 'react';
import './Modal.module.scss';

const Modal = (props) => {

const animateModal = () => {
if (props.show === true) {
return('modal animate-in');
}

return('modal animate-out');
}

return (


{props.children}

);
};

export default Modal;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.