Listing 10-3: Cascading Styles in Components
This is testing whether styles cascade. Uncomment the style.css import in the code to see. Visit some of the other examples to see how an imported css file affects an entire application.
function StyledChild(props){
return (<p className="red">This is testing whether styles cascade.
Uncomment the style.css import in the code to see. Visit some of the other
examples to see how an imported css file affects an entire application.</p>)
}
export default StyledChild;
import StyledChild from './StyledChild';
import './style.css';
function StyledParent(props){
return (<StyledChild />)
}
export default StyledParent;
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.