Skip to content

Use react CSS modules #204

Closed
Closed
@vincaslt

Description

@vincaslt

I assumed create-react-app uses react-css-modules, but this code does not work (no styles applied):

import React from 'react'
import styles from './styles.css'

const TextField = ({children}) => (
  <div className={styles.inputContainer}>
    <span className={styles.inputLabel}>{children}</span>
    <input className={styles.inputField}/>
  </div>
)

export default TextField

It does, however, work when classes are defined as strings rather than scoped to this component. I think it wouldn't hurt to have this available for projects using create-react-app, what do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions