rrudy90023
rrudy90023

Reputation: 63

Can not see my class using classnames and React?

Using React and classnames to do styles. I get no errors but I get undefined when I console.log(styles.uiPad). I do get an object when I console.log(styles). My classnames import component also gets console.logged successfully but nothing happens. What am I doing wrong? Is this a webpack thing?

Here are my imports:

import styles from '../assets/stylesheets/base.scss'
import classNames  from 'classnames'

This is my render:

<div className={classNames(styles.uiPad)}></div>

Upvotes: 0

Views: 144

Answers (1)

Smaft
Smaft

Reputation: 142

You are importing a Sass file. You need to compile Sass into CSS before importing it.

Upvotes: 1

Related Questions