You are previewing ReactJS by Example - Building Modern Web Applications with React.
O'Reilly logo
ReactJS by Example - Building Modern Web Applications with React

Book Description

Get up and running with ReactJS by developing five cutting-edge and responsive projects

About This Book

  • Create pragmatic real-world applications while learning React and its modern developer tools

  • Build sustainable user interfaces by transforming data into components of UI

  • Learn how to generate reusable ReactJS components effectively

  • Who This Book Is For

    If you are a web developer and wish to learn ReactJS from scratch, then this book is tailor-made for you. Good understanding of Javascript, HTML, and CSS is expected.

    What You Will Learn

  • Create, reuse, and compose React components using JSX

  • Share data between various React components and techniques for data flow within a React app

  • Handle user interactions with the help of event handlers and dynamic components

  • Set up and use various next generation ES2015/ES6 features with React

  • Understand the performance and immutability features of React using React add-ons

  • Learn the techniques of Animation in React

  • Use data stores to store model-related data and information

  • Create a flux-based React application by using Reflux library

  • In Detail

    ReactJS is an open-source JavaScript library that brings the power of reactive programming to web applications and sites. It aims to address the challenges encountered in developing single-page applications, and is intended to help developers build large, easily scalable and changing web apps.

    Starting with a project on Open Library API, you will be introduced to React and JSX before moving on to learning about the life cycle of a React component. In the second project, building a multi-step wizard form, you will learn about composite dynamic components and perform DOM actions. You will also learn about building a fast search engine by exploring server-side rendering in the third project on a search engine application. Next, you will build a simple frontpage for an e-commerce app in the fourth project by using data models and React add-ons. In the final project you will develop a complete social media tracker by using the flux way of defining React apps and know about the best practices and use cases with the help of ES6 and redux.

    By the end of this book, you will not only have a good understanding of ReactJS but will also have built your very own responsive frontend applications from scratch.

    Style and approach

    An easy-to-follow program to learn ReactJS with the help of real world projects. Each topic is explained within the context of a project and provides plenty of tips and tricks for using ReactJS.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. ReactJS by Example - Building Modern Web Applications with React
      1. Table of Contents
      2. ReactJS by Example - Building Modern Web Applications with React
      3. Credits
      4. About the Authors
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with React
        1. What is React?
        2. When Shawn meets Mike and ReactJS
        3. Requiring React library
        4. Building our first component
        5. Back to work
        6. Displaying static data
        7. Passing data to components
        8. Summary
      9. 2. JSX in Depth
        1. Why JSX?
        2. Transforming JSX into JavaScript
        3. HTML tags vs React components
        4. Self closing tag
        5. Multiple components
        6. JavaScript expressions
        7. Namespaced components
        8. Spread attributes
        9. Styles in JSX
        10. JSX Gotchas
        11. Conditionals in JSX
        12. Non-DOM attributes
        13. Summary
      10. 3. Data Flow and Life Cycle Events
        1. Data flow in React
        2. Props validation
        3. Specifying default props
        4. Modifying this.props.children
        5. State
        6. Setting initial state
        7. Setting state
        8. Avoiding state
        9. State versus props
        10. Component life cycle overview
        11. Component life cycle methods
        12. Summary
      11. 4. Composite Dynamic Components and Forms
        1. Forms in React
        2. Setting up the application
        3. Getting started with forms
        4. Interactive props
        5. Controlled components
        6. Uncontrolled components
        7. Getting started with form wizard
        8. Form events
        9. Parent Child relationship
        10. Form validation
        11. Shipping details step
        12. Delivery details step
        13. Summary
      12. 5. Mixins and the DOM
        1. Back at the office
        2. Adding a modal
        3. Refs
        4. Summary
      13. 6. React on the Server
        1. Getting React to render on server
        2. On the server
        3. Summary
      14. 7. React Addons
        1. Getting started with Addons
          1. Immutability helpers
          2. Available commands
        2. Cloning components
          1. Helpers for testing React apps
            1. Setting up Jest
          2. Testing structure of React components
          3. Testing behavior of React components
          4. Shallow rendering
        3. Summary
      15. 8. Performance of React Apps
        1. Performance of React apps
        2. Virtual DOM
        3. The PERF addon
        4. DOM operations performed by React
          1. Time taken to render all the components
          2. Time wasted by React
          3. The shouldComponentUpdate hook
        5. PureRenderMixin
          1. The PureRenderMixin anti pattern
        6. Immutable data
        7. Summary
      16. 9. React Router and Data Models
        1. A new adventure
        2. Creating Backbone models
        3. Incorporating defined Backbone models
        4. Data models and Backbone
        5. Summary
      17. 10. Animation
        1. Fun stuff at Adequate LLC!
        2. Model updates
        3. Animate
        4. Summary
      18. 11. React Tools
        1. Development tools
          1. Using Babel for ES6 and JSX
          2. ESLint
        2. React Dev Tools
        3. Build tools
          1. What is Webpack?
          2. Webpack configuration
            1. Loaders
            2. Hot module replacement
        4. Summary
      19. 12. Flux
        1. Flux architecture and unidirectional flow
        2. Flux actions
        3. Flux stores
        4. Summary
      20. 13. Redux and React
        1. Redux
        2. Setting up Redux
        3. Summary
      21. Index