I trying to style a React component so that the individual elements can either be styled horizontally or vertically (with a non-flexbox solution).
How can I pass down styles to the component where individual styles are to be applied to the child elements of the component?
and
Where the styles only relevant for the horizontal are:
input, button {
vertical-align:middle;
}
button {
margin-left: 10px;
}
and only relevant for the vertical layout are:
.form-control {
display: inline-block;
}
.btn {
display: block;
margin: auto;
}
and the component is:
class Form extends React.Component {
render () {
return (
<form className="form-group">
<input className="form-control" type="text" placeholder="St. George, Utah"/>
<button className="btn">Get Weather</button>
</form>
);
}
}

