![]() So the configureStore function accepts a single configuration object parameter, with the following options: reducer, middleware, devTools, preloadedState, enhancers read more here.Ī friendly abstraction over the standard Redux createStore function that adds good defaults to the store setup for a better development experience. ![]() If you would like to view the source code you can check it out here:ĬonfigureStore() I will also introduce Redux thunk and request some data from a server.Īfter we have successfully created our project using create-react-app we will have a shiny, new project. It will contain one reducer slice, named counter.įor this article I’m going to extended the template so we can understand a bit more about what is happening. This create-react-app template will set you up a simple counter app. npx create-react-app my-app - template redux-typescript So let’s start! There is a create-react-app typescript template for this so will use that to start. It also takes a lot of the meta decision away from you and allows you to focus more on the important stuff: UX for users & performance. Yes it is opinionated, and at first it feels strange, but it’s maintained by the creators of redux so I think we can trust the direction the toolkit is taking. The Redux Toolkit is a set of best practises, patterns and functions which aid integrating and using redux in web apps. Then a redux maintainer reached out to me and shared with me their Redux Toolkit. ![]() In teams we would spend time deciding/debating/arguing the best patterns to use for our react/redux apps, and end up with a ‘Frankenstein’ approach which worked, was opinionated though was consistently out of sync from team to team. That pattern being essentially an actions file, a reducer for said file and then a root reducer to wrap all these files up. Originally this article was written based on a set of patterns I had learned and built upon over the last three years building react apps. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |