Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default class #109

Closed
craigcosmo opened this issue Jan 23, 2017 · 1 comment
Closed

default class #109

craigcosmo opened this issue Jan 23, 2017 · 1 comment
Labels

Comments

@craigcosmo
Copy link

craigcosmo commented Jan 23, 2017

classbtn = classnames({
    foo: this.state.status
})

<button className={classbtn}>submit</button>

From the code above, we have the classbtn will not return anything if this.state.status is false

What if we want it to return class bar if this.state.status is false?

@craigcosmo
Copy link
Author

Well it's pretty simple

classbtn = classnames({
    foo: this.state.status,
    bar: !this.state.status
})

<button className={classbtn}>submit</button>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants