-
-
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] Meta-Issue: Tutorials #3595
Comments
I was just browsing the analytics for the Redux docs. Here's the top 10 pages for the last week in pageviews:
So, this tells me that we've got a lot of folks actively learning React, and we should prioritize rewriting the tutorials. (And, that we need to get the tutorials right.) Before we can do that, we need to have an idea how we're going to rewrite them. Previous ThoughtsHere's my prior thoughts from #3313 :
Discussion Points and Questions
|
Hi! I’m a big fan of redux, first time contributor. Personally, I absolutely love the style of gobyexample. What I often end up doing on documentation sites is skimming code and only reading the explanations if the code is unhelpful. To provide further context, there could always be a link to a jsfiddle/stackblitz/etc. Though the depth of the current tutorials might be useful for some, it feels a bit daunting to have to go through 4-5 pages before being able to get started. So succinct examples that display something end to end would be super valuable. —— Something to the effect of: Creating a store
import { createStore } from 'redux'
export const store = createStore((todos = [], action) => {
switch (action.type) {
case 'ADD_TODO':
return [...todos, action.todo]
case 'REMOVE_TODO':
return todos.filter(todo => {
return todo !== action.todo
})
default:
return todos
}
})
// stateA = []
const stateA = store.getState()
store.dispatch({
type: 'ADD_TODO',
todo: 'my first todo',
})
// stateB = ['my first todo']
const stateB = store.getState()
// The two states are different objects,
// so this should be true:
// stateA !== stateB Subscribing to changes
import { createStore } from 'redux'
export const store = createStore((todos = [], action) => {
switch (action.type) {
case 'ADD_TODO':
return [...todos, action.todo]
case 'REMOVE_TODO':
return todos.filter(todo => {
return todo !== action.todo
})
default:
return todos
}
})
store.subscribe(state => {
console.log(state)
})
// Prints: ['my first todo']
store.dispatch({
type: 'ADD_TODO',
todo: 'my first todo',
})
// Prints: []
store.dispatch({
type: 'REMOVE_TODO',
todo: 'my first todo',
})
// Prints nothing, state doesn't change
store.dispatch({ type: 'foobar' }) |
I taught Redux to some React and JS novices in the past couple of weeks, and here are some rough initial thoughts/observations on an initial introductory sequence for the core concepts based both on what went well and what I wish I'd done differently:
Then:
(This is obviously premised on teaching the core library first and not teaching first via RTK) As we discussed on Reactiflux, @markerikson, if you think something like this would be of value, then I'd be happy to contribute some written tutorials for this sequence. |
Hi, adding my thoughts as a Redux learner upon @markerikson 's suggestion. After working with React for several months, I decided to try my hand at Redux. It took several separate attempts, but I finally had my lightbulb moment last week while working through the Redux half of The Net Ninja's React & Redux course (parts 34 onward). Below I'll briefly explain my general path to learning Redux, including the resources I used. I initially started with the main Redux.js site. Being self-taught, I looked for a resource that would walk me through the fundamentals of Redux, including the theory and how to implement it in an app. Having no previous experience with Redux, I felt a little lost with the basic to-do list tutorial, so I jumped to the list of Redux resources. I tried Dan Abramov's Egghead.io course, having heard a lot of people recommend it. While I was able to grasp the basic concepts discussed in the first few videos, I felt like I was missing a lot of the context I needed to truly grasp what was going on and where everything fit in. I was also having trouble understanding how I would apply Redux to the structure of a modern small-to-midsize React app. I then watched Mark's "The Fundamentals of Redux" talk. This was really effective in teaching me the core concepts of Redux — how the store, reducers, actions, and provider work together to manage state across an app. For me, the next step was to apply it to an actual app. I tried playing around with some of the example apps but had a hard time making the leap from knowing the core concepts to seeing the code implemented in an actual app and knowing how to do that. The tutorial structure on the Redux.js site —building the actions, reducers, and stores in isolated environments, and then showing how it fits together in the end — didn't mesh with my personal style of learning. The video series linked at the top of this post worked for me because the instructor explained how the different parts of Redux worked while implementing them in a basic React app using a structure I was familiar with. I'd be happy to clarify my explanation if any parts didn't make sense. Hope this feedback helps! |
A short article that says:
http://evanxmerz.com/blog/index.php/2020/01/18/redux-explained-in-one-simple-sentence/ |
Shorthand notes on the goals for redoing the existing tutorial sequence, since I keep pasting these in various places:
|
Can I write a tutorial on how an over-simplified connect works with context api? Here is an example of using context API to get it done. ( i remember a gist from gaearon ) I have some written docs for the tutorial, although its a rough draft. |
For context: #3594 (comment)
The reasoning behind my "choice" for the Basic tutorial was that I could learn how to write an action, without having to follow a long tutorial. It could as well be written with RTK. Now after some looking around I understand that you want the documentation to focus on tutorials, while I am more of a "how-to guides" person as described in https://documentation.divio.com/ Besides, I've seen mentions of setting a "path" for the user. Getting something quickly setup with the "old way" before transforming the code to use RTK would make sense imo. They would gain a better understanding of what RTK does. Maybe Essentials and (Basic + Advanced) should be split into "Modern" and "Classic" a la Relay to make the distinction clear. Or maybe we don't need the distinction. It seems to me Essentials is already doing the job of Basics and Advanced. They could be merged. I like your idea of Basics - Standard - Real World even though the line between Standard and Real World is really thin.
Real world would be the "RWU" section, acting more like the current recipes. It might not be realistic to put a real world application into a tutorial, this should be an example like https://github.com/reduxjs/examples/tree/master/real-world I definitely lack a lot of insight so if I'm raising questions that are already answered please tell me. |
@sbaudray : Yeah, I think you're sorta over-analyzing what I'm looking for here :) As described in #3855, the new "Essentials" tutorial focuses on "how to use Redux the modern way to build real-world apps using RTK", but doesn't cover the lower-level primitives and concepts that RTK is built on. The goal of the "Basics" tutorial is to explain those lower-level primitives. So, it's not so much about "modern" and "classic", but rather "higher-level abstraction" and "what those abstractions are abstracting". I definitely don't intend to cover SSR in a tutorial. There may be some value in having a separate TS-specific tutorial in addition to the "Usage with TS" page, though, but definitely not including that in either the "Essentials" or "Basics" tutorials. |
The new "Redux Fundamentals" tutorial is now live! The "Fundamentals" tutorial teaches "how Redux works", from the ground up, and finishes by showing how Redux Toolkit simplifies the common Redux usage patterns: https://redux.js.org/tutorials/fundamentals/part-1-overview I'm going to declare that the actual work of rewriting the tutorials is complete, and close this issue. However, just because it's been merged doesn't mean the content is immutable (😀 ). I'd love to hear additional feedback both from the people who commented in this thread and anyone else who might have thoughts on it. In particular for the folks in this thread, does the new "Fundamentals" tutorial address the concerns and suggestions you've raised already? |
This is a tracking issue to cover all tasks related to rewriting and updating the "Tutorials" section.
Tasks
Add "Barebones" tutorialRenamed "Advanced" to "Standard" and rewriteThe text was updated successfully, but these errors were encountered: