-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs Rewrite] Rewrite the existing "Basics/Advanced" tutorial sequence #3855
Comments
Everything looks awesome, just have some feedback on the action naming part.
could have an example of a simple thunk creator function that's passed |
@MilosRasic yeah, I'm inclined to go with The point of the inline action names is to remove the extra line of code needed for the old classic Similarly, the purpose of this tutorial is to show the mechanics and how you would write this code "by hand", so that you later understand what RTK's abstractions do for you. In fact, I think the best way to finish this tutorial would be to migrate all the code we write over to RTK to show how much nicer it is. |
Basics Tutorial Rewrite PlansInitial ThoughtsHere's my initial thoughts on how to tackle this:
OutlinePart 1: Redux Overview
Part 2: Redux Terms and Data Flow
Part 3: Actions and Reducers
Part 4: Store
Part 5: UI
Part 6: Async Logic and Data Flow
Part 7: Standard Redux Patterns
Part 8: Modern Redux
Part 9: Next Steps
|
And this is now LIVE! |
Overview
The existing Redux "Basics/Advanced" tutorial sequence desperately needs to be rewritten. While it's been useful for many people, the target audience of the Redux docs has changed considerably since Dan first put it together. At the time, Dan said:
Clearly, the audience today is very different.
The existing tutorial teaches Redux using a "bottom-up" approach, explaining how each piece works individually, and building up towards putting them together into something useful. The new "Redux Essentials" tutorial that I just wrote teaches Redux "top-down", explaining "how to use it the right way", but not covering how it works. Both approaches are needed.
Flaws with the Tutorial
connect
as the main React-Redux APIconst ADD_TODO = "ADD_TODO"
, having separate folders for/actions
and/reducers
, etc. We now recommend against those approaches, so we need to stop teaching them.Goals
My main goals here are:
{type: "todos/addTodo"}
vsconst ADD_TODO = "ADD_TODO"
, single-file Redux logic)I'll need to figure out how to balance teaching the individual concepts, with having a coherent set of examples and explanations.
Existing Redux Tutorial Sequence Notes
Previous Personal Notes
Feedback
Introduction
-"Motivation" is a bit dated ("models", the "time to give up?" link)
Basics
/basics
- should be/tutorials/something
Actions
const ADD_TODO = 'ADD_TODO'
type
property that indicates the type of action being performed"payload
moreindex
instead of the whole todo", but rephrase this somehowdispatch
and none of that's been mentioned yetReducers
normalizr
instead of our own docs pageObject.assign({}, state, arg)
: ew!Object.assign()
warning (ES6? really?)immutability-helper
,updeep
, andImmutable.js
combineReducers
/ imports / reducer naming are a bit confusingStore
Data Flow
todoApp
without defining ittodoAppReducer
or somethingcombineReducers
exampleUsage with React
deku
libconnect
"TodoList
pass down click handlers, and lettingTodo
dispatch its own actions?Advanced
This section should not at all be called "advanced". This is pretty key info, and the only real distinction here is that it's stuff that goes beyond using Redux synchronously by itself. Consider renaming it to something else.
Async Actions
error
flag, even despite FSA. Drop that.redux-actions
action.payload
, etcreceivePosts()
convertsjson.data.children.map()
. Good idea, or bad idea?Object.assign
invalidateSubreddit
async/await
?Async Flow
Middleware
applyMiddleware
store
tostoreAPI
Usage with React Router
Example: Reddit API
Next Steps
The text was updated successfully, but these errors were encountered: