Skip to content

Instantly share code, notes, and snippets.

@colinmeinke
Created October 1, 2015 17:29
Show Gist options
  • Save colinmeinke/1a1434d4843bcbebb10f to your computer and use it in GitHub Desktop.
Save colinmeinke/1a1434d4843bcbebb10f to your computer and use it in GitHub Desktop.
React inline styles
import React, { Component } from 'react';
import { baseStyle, loadingStyle } from './buttonStyle';
class Button extends Component {
render () {
return (
<button
style={{
...baseStyle,
...( this.props.isLoading ? loadingStyle : {}),
}}
>
{ this.props.text }
</button>
);
}
}
const baseStyle = {
backgroundColor: blue,
};
const loadingStyle = {
backgroundColor: grey,
};
export { baseStyle, loadingStyle };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment