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

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

Offen
#253 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
2k
Forks
159
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.