Getting Started
Redux is a phenomenally powerful tool, and it can be a true joy to work with. But it takes time to find good tooling and develop healthy patterns.
Retreon aims to provide good patterns and strong types out of the box, including tools for async actions and error handling. Retreon is FSA compliant.
Here's a taste:
// actions.tsconst changeTheme = createAction('change-theme', (theme: Theme) => { localStorage.setItem('theme-preference', theme); return theme})
// reducer.tsconst reducer = createReducer({ theme: 'light' }, handleAction => [ handleAction(changeTheme, (state, theme) => { state.theme = theme }),])
If you prefer to learn by example, take a gander at the examples directory, or check out TodoMVC to see a functioning application.
Be aware that retreon is designed for TypeScript, and while it works fine in vanilla JS, you lose a lot of value. All the examples are written assuming you're using TypeScript.
#
InstallationRetreon can be installed through npm.
# NPMnpm install retreon
# Yarnyarn add retreon
Retreon depends on middleware to implement async actions and error handling. Once it's installed, register it with your redux store:
// Wherever you create your redux store...import { middleware } from 'retreon'
createStore(reducer, applyMiddleware(middleware))