1

I am probably going about this the wrong way, but is it possible to add styles from and external CSS file within a a reactjs component? I have tried to do it the conventional way however this does not seem to work, where you reference the class or id within the external css and do all your styling there.

    var ProfilePanel = React.createClass({
  render: function() {
    return (
      <div>
        <p class="profile-text">{this.props.text}{this.props.children}</p>    
      </div>
    );
  }
});

and within my CSS I have:

    .profile-text{
        font-size: 10px;
    }

1 Answer 1

6

You're using class which is reserved by js. You need to use className and should work.

Read more

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.