![]() Create a Redux store using RTK's configureStore API, and pass in at least one reducer function.If you're setting up a new project from scratch without that template, follow these steps: The Redux template for CRA comes with Redux Toolkit and React-Redux already configured. If you want to know specific details on how to add Redux to a project, see this explanation: Detailed Explanation: Adding Redux to a React Project This lets you jump right into writing your actual application code without having to add the Redux packages and set up the store. It comes with Redux Toolkit and React-Redux already configured, using a modernized version of the "counter" app example you saw in Part 1. We recommend using the Redux templates for Create-React-App as the fastest way to create a new Redux + React project. Once you've finished this tutorial, you'll probably want to try working on your own projects. If you'd like to see the final version of what we're going to build, you can check out the tutorial-steps branch, or look at the final version in this CodeSandbox. ![]() After cloning the repo, you can install the tools for the project with npm install, and start it with npm start. You can also clone the same project from this Github repo. To get started, you can open and fork this CodeSandbox: You'll use this as the basis for writing the actual application code. Redux Fundamentals, Part 8: Modern Redux with Redux Toolkit, which shows how to convert the low-level examples from earlier sections into modern Redux Toolkit equivalentsÄŻor this tutorial, we've created a pre-configured starter project that already has React set up, includes some default styling, and has a fake REST API that will allow us to write actual API requests in our app.We recommend that all Redux learners should read the "Essentials" tutorial! The full "Redux Essentials" tutorial, which teaches "how to use Redux, the right way" with Redux Toolkit for real-world apps.See these pages to learn how to use "modern Redux" with Redux Toolkit: It's not meant to be a production-ready project. Note that this tutorial intentionally shows older-style Redux logic patterns that require more code than the "modern Redux" patterns with Redux Toolkit we teach as the right approach for building apps with Redux today, in order to explain the principles and concepts behind Redux.
0 Comments
Leave a Reply. |