Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
React Cookbook

You're reading from   React Cookbook Create dynamic web apps with React using Redux, Webpack, Node.js, and GraphQL

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781783980727
Length 580 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Carlos Santana Roldán Carlos Santana Roldán
Author Profile Icon Carlos Santana Roldán
Carlos Santana Roldán
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Working with React 2. Conquering Components and JSX FREE CHAPTER 3. Handling Events, Binding and Useful React Packages 4. Adding Routes to Our Application with React Router 5. Mastering Redux 6. Creating Forms with Redux Form 7. Animations with React 8. Creating an API with Node.js Using MongoDB and MySQL 9. Apollo and GraphQL 10. Mastering Webpack 4.x 11. Implementing Server-Side Rendering 12. Testing and Debugging 13. Deploying to Production 14. Working with React Native 15. Most Common React Interview Questions
16. Other Books You May Enjoy

Styling a component with CSS classes and inline styles

In the last recipe, we learned how to create a class component. Now let's add some CSS to our Home component.

In React, one of the best practices is to have the style file in the same directory as the component. If you have worked with PHP, Node, or any other server language, you probably write your styles in a style.css file, and you include it using a link tag in your template. React uses Webpack, which is the most popular module bundler at the moment. With Webpack, we can configure the way that we want to handle our styles (using CSS directly or by using a CSS preprocessor such as Sass, Stylus, or Less CSS), and with Webpack we can implement CSS modules. This is a powerful way to avoid the three main issues of CSS:

  • No more conflicts (unintentional CSS...
You have been reading a chapter from
React Cookbook
Published in: Aug 2018
Publisher: Packt
ISBN-13: 9781783980727
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime