My learning diary

Center

Why “Center” instead of “Centre”? Well, that’s because “center” is the version used in CSS. There were moments in my life when I wanted to give up writing in British English. There are so many other people using American English… except for me. Programming languages are expressed using American English as well. I felt like a rebel for naming my variables in British English, but that’s what I’ve learnt in school.

Continue reading "Center"

redux-persist

If you need your Redux store to last beyond a page load or refresh, look no further! redux-persist is here to the rescue. Based on this guide and this guide, you need to update your reducers and store to enjoy persistence: Install redux-persist: yarn add redux-persist @types/redux-persist Update root reducer and store: // Copied from the official README and edited import { Provider } from 'react-redux'; import { createStore, Store } from 'redux'; import { persistReducer, persistStore } from 'redux-persist'; import storage from 'redux-persist/lib/storage'; import rootReducer from '.

Continue reading "redux-persist"

Challenges of a multi-step flow with permalinks

I decided to invest my time into covering the edge cases that were not handled by Design #1. Refer to yesterday’s post for the context. The edge cases are: Forms which need data from the preceding forms Dynamic form links I can deal with the first pain point by leveraging query parameters. A persistent Redux store is not needed (yet). A persistent Redux store is one which persists between page loads and refreshes.

Continue reading "Challenges of a multi-step flow with permalinks"

Multi-step forms

I have a few pages which I need to chain into a single form flow. I also need to display a progress bar at the top of each form. I need to do some rearchitecting. Reasons: If we do not do anything, we will need to insert <ProgressBar .../> and the like into every form component. Sharing the forms/pages across other flows which do not need to progress bar is difficult.

Continue reading "Multi-step forms"