Listing 10-6: Using Variables to Hold Style Objects
Look out!
function WarningMessage(props){
const warningStyle = {color:"red",padding:"6px",backgroundColor:"#000000"};
return (
<p style={warningStyle}>
{props.warningMessage}
</p>
)
}
export default WarningMessage;
Download the examples, report issues, and ask/answer questions in the discussion area by visiting the book's github page. All of the code for the book is also available on codesandbox.io for you to play around with.
ReactJS Foundations is published by John Wiley and Sons, Inc and is available in paperback and eBook.