Skip to content

Commit eb79318

Browse files
jshoungjulian
and
julian
authored
Remove outdated content in "Do I have to put all my state into Redux?" (#4434)
Co-authored-by: julian <[email protected]>
1 parent cc9181d commit eb79318

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

docs/faq/OrganizingState.md

+2-21
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sidebar_label: Organizing State
1111
- [Redux FAQ: Organizing State](#redux-faq-organizing-state)
1212
- [Table of Contents](#table-of-contents)
1313
- [Organizing State](#organizing-state)
14-
- [Do I have to put all my state into Redux? Should I ever use React's `setState()`?](#do-i-have-to-put-all-my-state-into-redux-should-i-ever-use-reacts-setstate)
14+
- [Do I have to put all my state into Redux? Should I ever use React's `useState` or `useReducer`?](#do-i-have-to-put-all-my-state-into-redux-should-i-ever-use-reacts-usestate-or-usereducer)
1515
- [Further information](#further-information)
1616
- [Can I put functions, promises, or other non-serializable items in my store state?](#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)
1717
- [Further information](#further-information-1)
@@ -22,7 +22,7 @@ sidebar_label: Organizing State
2222

2323
## Organizing State
2424

25-
### Do I have to put all my state into Redux? Should I ever use React's `setState()`?
25+
### Do I have to put all my state into Redux? Should I ever use React's `useState` or `useReducer`?
2626

2727
There is no “right” answer for this. Some users prefer to keep every single piece of data in Redux, to maintain a fully serializable and controlled version of their application at all times. Others prefer to keep non-critical or UI state, such as “is this dropdown currently open”, inside a component's internal state.
2828

@@ -37,37 +37,18 @@ Some common rules of thumb for determining what kind of data should be put into
3737
- Do you want to cache the data (ie, use what's in state if it's already there instead of re-requesting it)?
3838
- Do you want to keep this data consistent while hot-reloading UI components (which may lose their internal state when swapped)?
3939

40-
There are a number of community packages that implement various approaches for storing per-component state in a Redux store instead, such as [redux-component](https://github.com/tomchentw/redux-component), [redux-react-local](https://github.com/threepointone/redux-react-local), and more. It's also possible to apply Redux's principles and concept of reducers to the task of updating local component state as well, along the lines of `this.setState( (previousState) => reducer(previousState, someAction))`.
4140

4241
#### Further information
4342

4443
**Articles**
4544

4645
- [When (and when not) to reach for Redux](https://changelog.com/posts/when-and-when-not-to-reach-for-redux)
47-
- [Finding `state`'s place with React and Redux](https://medium.com/@adamrackis/finding-state-s-place-with-react-and-redux-e9a586630172)
48-
- [A Case for setState](https://medium.com/@zackargyle/a-case-for-setstate-1f1c47cd3f73)
49-
- [How to handle state in React: the missing FAQ](https://medium.com/react-ecosystem/how-to-handle-state-in-react-6f2d3cd73a0c)
50-
- [Where to Hold React Component Data: state, store, static, and this](https://medium.freecodecamp.com/where-do-i-belong-a-guide-to-saving-react-component-data-in-state-store-static-and-this-c49b335e2a00)
51-
- [The 5 Types of React Application State](http://jamesknelson.com/5-types-react-application-state/)
52-
- [Shape Your Redux Store Like Your Database](https://hackernoon.com/shape-your-redux-store-like-your-database-98faa4754fd5)
5346

5447
**Discussions**
5548

56-
- [#159: Investigate using Redux for pseudo-local component state](https://github.com/reduxjs/redux/issues/159)
57-
- [#1098: Using Redux in reusable React component](https://github.com/reduxjs/redux/issues/1098)
58-
- [#1287: How to choose between Redux's store and React's state?](https://github.com/reduxjs/redux/issues/1287)
59-
- [#1385: What are the disadvantages of storing all your state in a single immutable atom?](https://github.com/reduxjs/redux/issues/1385)
60-
- [Twitter: Should I keep something in React component state?](https://twitter.com/dan_abramov/status/749710501916139520)
61-
- [Twitter: Using a reducer to update a component](https://twitter.com/dan_abramov/status/736310245945933824)
62-
- [React Forums: Redux and global state vs local state](https://discuss.reactjs.org/t/redux-and-global-state-vs-local-state/4187)
6349
- [Reddit: "When should I put something into my Redux store?"](https://www.reddit.com/r/reactjs/comments/4w04to/when_using_redux_should_all_asynchronous_actions/d63u4o8)
64-
- [Stack Overflow: Why is state all in one place, even state that isn't global?](https://stackoverflow.com/questions/35664594/redux-why-is-state-all-in-one-place-even-state-that-isnt-global)
6550
- [Stack Overflow: Should all component state be kept in Redux store?](https://stackoverflow.com/questions/35328056/react-redux-should-all-component-states-be-kept-in-redux-store)
6651

67-
**Libraries**
68-
69-
- [Redux Addons Catalog: Component State](https://github.com/markerikson/redux-ecosystem-links/blob/master/component-state.md)
70-
7152
### Can I put functions, promises, or other non-serializable items in my store state?
7253

7354
It is highly recommended that you only put plain serializable objects, arrays, and primitives into your store. It's _technically_ possible to insert non-serializable items into the store, but doing so can break the ability to persist and rehydrate the contents of a store, as well as interfere with time-travel debugging.

0 commit comments

Comments
 (0)