Skip to content

Create Thinking in Redux category and move some pages in it #3889

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

Merged
merged 3 commits into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/basics/DataFlow.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Redux architecture revolves around a **strict unidirectional data flow**.

This means that all data in an application follows the same lifecycle pattern, making the logic of your app more predictable and easier to understand. It also encourages data normalization, so that you don't end up with multiple, independent copies of the same data that are unaware of one another.

If you're still not convinced, read [Motivation](../introduction/Motivation.md) and [The Case for Flux](https://medium.com/@dan_abramov/the-case-for-flux-379b7d1982c6) for a compelling argument in favor of unidirectional data flow. Although [Redux is not exactly Flux](../introduction/PriorArt.md), it shares the same key benefits.
If you're still not convinced, read [Motivation](../thinking-in-redux/Motivation.md) and [The Case for Flux](https://medium.com/@dan_abramov/the-case-for-flux-379b7d1982c6) for a compelling argument in favor of unidirectional data flow. Although [Redux is not exactly Flux](../thinking-in-redux/PriorArt.md), it shares the same key benefits.

The data lifecycle in any Redux app follows these 4 steps:

Expand Down
2 changes: 1 addition & 1 deletion docs/basics/Store.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can see how this causes the state held by the store to change:

<img src='https://i.imgur.com/zMMtoMz.png' width='70%' />

We specified the behavior of our app before we even started writing the UI. We won't do this in this tutorial, but at this point you can write tests for your reducers and action creators. You won't need to mock anything because they are just [pure](../introduction/ThreePrinciples.md#changes-are-made-with-pure-functions) functions. Call them, and make assertions on what they return.
We specified the behavior of our app before we even started writing the UI. We won't do this in this tutorial, but at this point you can write tests for your reducers and action creators. You won't need to mock anything because they are just [pure](../thinking-in-redux/ThreePrinciples.md#changes-are-made-with-pure-functions) functions. Call them, and make assertions on what they return.

## Source Code

Expand Down
2 changes: 1 addition & 1 deletion docs/faq/General.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ In the end, Redux is just a tool. It's a great tool, and there are some great re

**Documentation**

- [Introduction: Motivation](../introduction/Motivation.md)
- [Thinking in Redux: Motivation](../thinking-in-redux/Motivation.md)

**Articles**

Expand Down
3 changes: 0 additions & 3 deletions docs/introduction/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Introduction

- [Motivation](Motivation.md)
- [Core Concepts](CoreConcepts.md)
- [Three Principles](ThreePrinciples.md)
- [Prior Art](PriorArt.md)
- [Learning Resources](LearningResources.md)
- [Ecosystem](Ecosystem.md)
- [Examples](Examples.md)
4 changes: 2 additions & 2 deletions docs/recipes/ReducingBoilerplate.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ hide_title: true

# Reducing Boilerplate

Redux is in part [inspired by Flux](../introduction/PriorArt.md), and the most common complaint about Flux is how it makes you write a lot of boilerplate. In this recipe, we will consider how Redux lets us choose how verbose we'd like our code to be, depending on personal style, team preferences, longer term maintainability, and so on.
Redux is in part [inspired by Flux](../thinking-in-redux/PriorArt.md), and the most common complaint about Flux is how it makes you write a lot of boilerplate. In this recipe, we will consider how Redux lets us choose how verbose we'd like our code to be, depending on personal style, team preferences, longer term maintainability, and so on.

## Actions

Actions are plain objects describing what happened in the app, and serve as the sole way to describe an intention to mutate the data. It's important that **actions being objects you have to dispatch is not boilerplate, but one of the [fundamental design choices](../introduction/ThreePrinciples.md) of Redux**.
Actions are plain objects describing what happened in the app, and serve as the sole way to describe an intention to mutate the data. It's important that **actions being objects you have to dispatch is not boilerplate, but one of the [fundamental design choices](../thinking-in-redux/ThreePrinciples.md) of Redux**.

There are frameworks claiming to be similar to Flux, but without a concept of action objects. In terms of being predictable, this is a step backwards from Flux or Redux. If there are no serializable plain object actions, it is impossible to record and replay user sessions, or to implement [hot reloading with time travel](https://www.youtube.com/watch?v=xsSnOQynTHs). If you'd rather modify data directly, you don't need Redux.

Expand Down
2 changes: 1 addition & 1 deletion docs/style-guide/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ If multiple dispatches are truly necessary, consider batching the updates in som

### Evaluate Where Each Piece of State Should Live

The ["Three Principles of Redux"](../introduction/ThreePrinciples.md) says that "the state of your whole application is stored in a single tree". This phrasing has been over-interpreted. It does not mean that literally _every_ value in the entire app _must_ be kept in the Redux store. Instead, **there should be a single place to find all values that _you_ consider to be global and app-wide**. Values that are "local" should generally be kept in the nearest UI component instead.
The ["Three Principles of Redux"](../thinking-in-redux/ThreePrinciples.md) says that "the state of your whole application is stored in a single tree". This phrasing has been over-interpreted. It does not mean that literally _every_ value in the entire app _must_ be kept in the Redux store. Instead, **there should be a single place to find all values that _you_ consider to be global and app-wide**. Values that are "local" should generally be kept in the nearest UI component instead.

Because of this, it is up to you as a developer to decide what state should actually live in the Redux store, and what should stay in component state. **[Use these rules of thumb to help evaluate each piece of state and decide where it should live](../faq/OrganizingState.md#do-i-have-to-put-all-my-state-into-redux-should-i-ever-use-reacts-setstate)**.

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions website/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@

# Old old Gitbook links?
/docs/introduction/CoreConcepts.html /introduction/core-concepts
Copy link
Contributor

@markerikson markerikson Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❗ These are the very old legacy Gitbook links. We do need to update these, but we also need to add new redirects from the current URLs as well.

Can you start a new comment-block-ish section somewhere labeled "2020 site reorganization" or soemthing along those lines, and add new redirect entries there from /introduction/ to /thinking-in-redux/ (or whatever we finally settle on) for these pages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be better now

/docs/introduction/Motivation.html /introduction/motivation
/docs/introduction/Motivation.html /thinking-in-redux/motivation
/docs/introduction/Ecosystem.html* /introduction/ecosystem:splat
/docs/introduction/CoreConcepts.html /introduction/core-concepts
/docs/introduction/PriorArt.html /introduction/prior-art
/docs/introduction/ThreePrinciples.html /introduction/three-principles
/docs/introduction/PriorArt.html /thinking-in-redux/prior-art
/docs/introduction/ThreePrinciples.html /thinking-in-redux/three-principles
/docs/introduction/Examples.html* /introduction/examples:splat
/docs/introduction/ /introduction/getting-started

Expand Down Expand Up @@ -144,4 +144,4 @@
/feedback /introduction/getting-started#help-and-discussion

# PR preview for the new tutorial
/tutorials/quick-start/quick-start-part-1 /tutorials/essentials/part-1-overview-concepts
/tutorials/quick-start/quick-start-part-1 /tutorials/essentials/part-1-overview-concepts
8 changes: 5 additions & 3 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ module.exports = {
Introduction: [
'introduction/getting-started',
'introduction/installation',
'introduction/motivation',
'introduction/core-concepts',
'introduction/three-principles',
'introduction/prior-art',
'introduction/learning-resources',
'introduction/ecosystem',
'introduction/examples'
],
'Thinking In Redux': [
'thinking-in-redux/motivation',
'thinking-in-redux/three-principles',
'thinking-in-redux/prior-art'
],
Tutorials: [
'tutorials/tutorials-index',
{
Expand Down