Я хочу динамически менять цвет фона кнопки динамически.React Radium - Как динамически менять значения свойств
Если это файл моего радий стили расслоения плотного:
пуговицы styles.js
export const styles = {
base: {
backgroundColor: 'red',
}
};
button.js
const myStyles = require('./styles/button-styles.js');
@Radium
class MyButton extends Component {
render() {
{/*
How do I tell the button to override the default value
for background color of red, to the props value if it exists,
(and in this scenario it does and is the color green)?
*/}
return (<Button style={ ??? }>Click Me</Button>)
}
}
MyButton.defaultProps = {
btnBg: 'green'
}
MyButton.propTypes = {
btnBg: PropTYpes.string
}
(Побочное примечание полномочия, которые есть, нет метки реакционного радиуса.)