Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

44 lines (32 sloc) 869 Bytes

CSS Modules with React

Demo.js

import React from 'react'
import CSSModules from 'react-css-modules'
/* import your css modules styles for the component */
import styles from './Demo.css' 

function Demo( props) {

    const { route } = props

    return (
    	<div styleName='demo'>
    		<button styleName='button blue'>press me</button>
       	</div>
    )
}

export default CSSModules(Demo, styles, {allowMultiple: true} )

index.js

import React from 'react'
import ReactDOM from 'react-dom'
import Demo from './components/Demo'

function App(props) {
    return (
        <main>
            <Demo />
        </main>        
    )
}

ReactDOM.render(React.createElement(App), document.getElementById('root'))
You can’t perform that action at this time.