Skip to Main Content
Modern Front-End Development for Rails, 2nd Edition
book

Modern Front-End Development for Rails, 2nd Edition

by Noel Rappin
September 2022
Intermediate to advanced content levelIntermediate to advanced
410 pages
10h 7m
English
Pragmatic Bookshelf
Content preview from Modern Front-End Development for Rails, 2nd Edition

Installing and Using Redux

We first need to install Redux, and the Redux binding for React:

 $ yarn add @reduxjs/toolkit react-redux

The current recommended way to use Redux is through the toolkit package at @reduxjs/toolkit, which provides a more useful API for creating Redux reducers. The core Redux package and the TypeScript definitions will be loaded as a dependency of these packages automatically.

I should note that the new version of Redux triggered TypeScript errors that I was only able to clear by adding the setting "allowSyntheticDefaultImports": true to the compilerOptions section of tsconfig.json—I’m not completely sure why this only triggered on the newest versions, but it has to do with allowing lines like import React from "react" ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern Front-End Development for Rails

Modern Front-End Development for Rails

Noel Rappin

Publisher Resources

ISBN: 9781680509977Errata Page