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

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

Aperta
#253 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2k
Fork
159
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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;
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.