You are previewing Developing a Redux Edge.
O'Reilly logo
Developing a Redux Edge

Book Description

This book is for anyone wanting to learn about Redux, a predictable state container for JavaScript apps. It is aimed at intermediate developers who have a good understanding of creating single page applications with JavaScript. Having an understanding of ES6, functional programming, and React will certainly help too, but isn’t necessary. If you want to follow along with the examples you should also know your way around a terminal, and know what Node and npm are, as well as having them installed and ready to use.

Table of Contents

  1. Preface
    1. Who is this book for?
    2. What do you need to know prior to reading?
  2. 1. Why Use Redux?
    1. Managing state is problematic
    2. How Redux helps
    3. Redux background
      1. The birth of Redux
    4. Redux influences
      1. Elm
      2. ES6
      3. Functional programming
      4. Immutability
      5. Flux
    5. Unidirectional data flow
      1. Two way data binding
    6. The three principles
      1. Single source of truth
      2. State is read only
      3. Changes are made with pure functions
    7. Looking ahead
    8. Conclusion
  3. 2. Core Concepts
    1. Actions
      1. What are actions used for?
      2. The shape of an action
      3. Action creators
      4. Maintaining your action shape
      5. Actions need an interpreter
    2. Reducers
      1. What are reducers?
      2. Using reducers in Redux
      3. Reducers are composable
    3. Store
    4. Middleware
      1. Why does middleware exist?
      2. Anatomy of a middleware
      3. How to use middleware
    5. Store enhancers
    6. How does Redux work?
      1. getState()
      2. dispatch(action)
      3. subscribe(listener)
    7. Connecting Redux to our UI
      1. The basic renderer
      2. The path to React
      3. The path to Angular 2
    8. State
    9. Conclusion
  4. 3. Redux Patterns
    1. Improving functions
      1. Concise functions
      2. Extracting parameters
    2. Reducer patterns
      1. Adding elements to arrays
      2. Removing elements from arrays
      3. Changing object properties
      4. Adding properties to objects
      5. Removing properties from objects
    3. Conclusion
  5. 4. Building the Sample App
    1. Application specification
      1. Actions
      2. Views
      3. Storage
    2. Setting up
      1. Methodology
      2. Stack
    3. Getting started
    4. Implementation
      1. Action creators
      2. Reducers
      3. Modifying state without a library
      4. Selectors
      5. Connecting to UI
    5. Conclusion
  6. 5. Syncing Data with the Server
    1. Application specification
      1. Actions
      2. Server
    2. Implementation
      1. Api module
      2. Action creators
      3. Updating reducers
      4. Saving a note to the server
      5. Fetching notes on initial render
      6. redux-thunk alternatives
    3. Conclusion
  7. 6. Showing Request State to Users
    1. App spec
      1. Pending, success, and failure states
      2. Toast notifications
    2. Implementation
      1. Logger
      2. Requests
      3. Toasts
      4. Cleanup
    3. Conclusion
  8. 7. Persisting State on Client
    1. How much to persist
    2. Automatic vs manual persistence
    3. Manual persistence
      1. Persisting state
      2. Restoring state
    4. Automatic persistence
      1. Persisting state
      2. Refactoring
    5. Production Use
    6. Conclusion
  9. 8. Analytics Middleware
    1. Why is this useful?
      1. Middleware Specification
      2. Creating the middleware
      3. Augment actions
      4. Further refactoring
      5. Accessing our entire state within our track function
      6. Final implementation
    2. Conclusion
  10. 9. Best Practices
    1. Actions
      1. Disambiguation
    2. Reducers
      1. Reducer initial state
    3. Selectors
      1. Tips
    4. Middleware, store enhancers
      1. Tips
    5. Project Structure
      1. Organizing by Concept Type
      2. Organizing by Feature or Domain
      3. Alternatives
      4. General Insights
    6. UI, Rendering Tips
    7. Developer tools
    8. Testing Tips
    9. Conclusion
  11. 10. Going offline
    1. Using Service Workers in your app
    2. Implementing a middleware that can selectively store and sync data based on actions
    3. Offloading the store’s work to workers
    4. Recommended reads
    5. Conclusion