Redux in Action ペーパーバック – 2018/6/14
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
With Redux in Action, you'll discover how to integrate Redux into your React application and development environment. With the insights you glean from the experience of authors Marc Garreau and Will Faurot, you'll be more than confident in your ability to solve your state management woes with Redux and focus on developing the apps you need!
Foreword by Mark Erikson, Redux co-maintainer.
Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.
About the Technology
With Redux, you manage the state of a web application in a single, simple object, practically eliminating most state-related bugs. Centralizing state with Redux makes it possible to quickly start saved user sessions, maintain a reliable state history, and smoothly transfer state between UIs. Plus, the Redux state container is fully programmable and integrates cleanly with React and other popular frameworks.
About the Book
Redux in Action is an accessible guide to effectively managing state in web applications. Built around common use cases, this practical book starts with a simple task-management application built in React. You'll use the app to learn the Redux workflow, handle asynchronous actions, and get your hands on the Redux developer tools. With each step, you'll discover more about Redux and the benefits of centralized state management. The book progresses to more-complex examples, including writing middleware for analytics, time travel debugging, and an overview of how Redux works with other frameworks such as Angular and Electron.
- Using Redux in an existing React application
- Handling side effects with the redux-saga library
- Consuming APIs with asynchronous actions
- Unit testing a React and Redux application
About the Reader
About the Author
Marc Garreau has architected and executed half a dozen unique client-side applications using Redux. Will Faurot is a mentor for Redux developers of all skill levels.
Table of Contents
- Introducing Redux
- Your first Redux application
- Debugging Redux applications
- Consuming an API
- Handling complex side effects
- Preparing data for components
- Structuring a Redux store
- Testing Redux applications
- Structuring Redux code
- Redux beyond React
Marc Garreau has architected and executed half a dozen unique client-side applications leveraging Redux for state management.
Will Faurot is experienced in equal parts production Redux, and mentoring Redux developers of all skill levels.
Instead of a systematic explanation building up from the basics to more complex topics, the authors use a complex 'project' which runs throughout the whole book. This makes it hard to follow and useless for reference (the poor index doesn't help much here). More time is spent trying to disentangle the project than learning Redux. There is some code available on the Manning website, but not the listings themselves, so, in order to 'follow along' (if one wanted to do that) everything would have to be typed in by hand or copied and pasted from the PDF. In any case, the book can't be used by itself as a learning tool. The version numbers of most of the libraries used are not mentioned in the text, so it isn't even possible to run snippets reliably.
The book starts with the usual pointless comparison with Flux. There's a short introduction to the basic components of Redux, followed by another chapter with a slightly more detailed overview. At the end of these two chapters - which are nowhere near enough to understand how Redux works - the book launches into more advanced topics such as Redux-Thunk.
There is little explanation about writing reducers until much later in the book. Detailed explanations of how to create reducers for the different types of data store such as arrays and objects are missing. CombineReducers is mentioned, but again, the explanation is sketchy and inadequate. Redux-Forms is not mentioned at all.
There is also nowhere near enough information about integrating with React, although there are a couple of pages of waffle about Ember and Angular. Given that most readers will be using React, there should be a discussion of how to integrate React-Router and a much more detailed and coherent explanation of how to use mapPropsToState and mapDispatchToState: these are difficult topics which need to be addressed properly.
It's obvious that two authors wrote the book: at times, it seems like two books were meshed together without much thought. For example, reducers are explained (badly) in one place and then (slightly better) somewhere else. The same is true of asynchronous libraries such as Redux-Thunk and Redux-Saga.
The book claims, implausibly, that 20 people read through the text and commented on it. Unfortunately, they didn't spot the typos.
The authors explain that "state in Redux is represented by a single source of truth, is read-only, and changes to it must be made with pure functions."
Redux is now "the most widely used state management solution for React applications," according to Mark Erikson, a Redux co-maintainer. "It's also been adopted for use by the Angular, Ember, and Vue communities and inspired dozens of imitations and spinoffs." (This book's chapter 12 gives good introductions to how Redux is being used outside of React.)
Throughout "Redux in Action," you build, test and enhance an application named Parsnip. Parsnip is a "Kanban board, a tool that allows users to organize and prioritize work (similar to Trello, Waffle, Asana, and a number of other tools). An app like this is highly interactive and requires complex state management--a perfect vehicle for us to apply Redux skills," the authors point out.
The book follows a typical Manning how-to flow: Introductions, some key theory and definitions in the first chapter, a sample application in the second chapter to get you up and running, and learning how to work with Redux developer tools in the third chapter. From there the learning curve continues as you see how to set up a local server and handle API requests "within the Redux pattern." Then comes a chapter on middleware, a chapter on handling some complex side effects and leveraging ES6 generator functions, plus a chapter on "the connection between the Redux store and your views," how selector functions work, and implementing "a robust solution using the reselect library." Next, the book offers a chapter on how to best structure data in the data store and consider "an alternative approach: normalization." The next chapter focuses on Redux testing and testing strategies. The final three chapters focus on: (1) how to keep a React-Redux application "lean and mean" using performance profiling tools, best practices, and "Redux-specific strategies for boosting performance"; (2) strategies for how to best organize a Redux application; and (3) "a quick tour of the role Redux can play in mobile, desktop, and other web-application environments" beyond React.
(My thanks to Manning Books for sending me an advance reading copy. I had tried picking up Redux from some online examples, but this work fills in many holes in that helter-skelter learning process!)