Skip to content
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

FAQ updates #1785

Closed
markerikson opened this issue May 30, 2016 · 51 comments
Closed

FAQ updates #1785

markerikson opened this issue May 30, 2016 · 51 comments
Labels

Comments

@markerikson
Copy link
Contributor

markerikson commented May 30, 2016

Summary

I did the initial grunt work of writing the FAQ. @gaearon did some editing, I added the TOC and the short question links, and it's been a great resource so far. Since then, I know @gaearon has pointed to a number of discussions and articles as being FAQ worthy, and I have a bunch of backlogged bookmarks and updates I need to sort through. Let's try to list any topics, links, or items we feel need to be added or updated.

Update

I added the updates to existing questions, but am currently focused on other tasks. If anyone is interested in helping write the "new" entries, I'd be happy to work with them regarding info, content, and editing!

Waiting to be Added

New topics

General

Code Structure

Performance

Design Decisions

React-Redux

Other

Updates to Existing Questions

It's not an FAQ item, but I'll leave a note for myself here rather than filing a new issue. The "Beyond combineReducers" page should have a mention of "double-nesting state", as in state.posts.posts, usually due to initial state defining a key and the slice reducer being given a key. . Definitely a common mistake.

Completed

New Topics

Immutability

Updates to existing questions

@gaearon
Copy link
Contributor

gaearon commented May 31, 2016

Also this seems popular and non-obvious.

https://twitter.com/dan_abramov/status/736310245945933824

@markerikson
Copy link
Contributor Author

Saw that image, and I'm only partially following what's going on there. Or rather, I see the code, I'm just not quite understanding the intent or the statement.

Is the intent that you're rendering a "connected-like" component, except that the "dispatch" and "reducing" is actually just updating the parent component state?

I'm also not understanding the bit about "detaching" the reducer, since there's no actual store or use of store.replaceReducer() in that snippet. You just mean that a "reducer-like" function can be applicable outside the context of the store's reducer structure?

@markerikson
Copy link
Contributor Author

New possible FAQ section, or possibly design doc: "Why Redux is designed the way it is". Example topics: why store.subscribe() doesn't include the action or state as an argument, why middleware is a nested function, etc.

@sompylasar
Copy link

Saw that image, and I'm only partially following what's going on there. Or rather, I see the code, I'm just not quite understanding the intent or the statement.

Is the intent that you're rendering a "connected-like" component, except that the "dispatch" and "reducing" is actually just updating the parent component state?

I'm also not understanding the bit about "detaching" the reducer, since there's no actual store or use of store.replaceReducer() in that snippet. You just mean that a "reducer-like" function can be applicable outside the context of the store's reducer structure?

The idea is: you don't need the redux library with the dedicated store object to implement redux architecture of (prevState, action) => nextState. The React component state can be your store, local to the component, and you implement dispatch yourself by doing state updates via React setState.

@markerikson
Copy link
Contributor Author

Yeah, that's sorta what I thought I was seeing. It was the "detach" phrasing that was really throwing me, because I'm aware you can actually call store.replaceReducer().

@yjcxy12
Copy link

yjcxy12 commented Jul 5, 2016

Regarding splitting logic between action creators and reducers, I think it's worth to point out that selectors(mapStateToComponent) is another good place to handle these(validation, data transform). This creates nice separation between true source from server (reducer) and view-related data that is computed (transformed or filtered) by source (selector).

Another question I see often is how to make a redux module(action creators, reducers, components) that can be reused externally. Mainly how to avoid action name clashing when we have multiple module with same type in the same page, and how to determine reducer name so it can be used by createStore.

@markerikson
Copy link
Contributor Author

Yeah, we definitely need a "Design Decisions" section of the FAQ.

@markerikson
Copy link
Contributor Author

Question for @reactjs/redux : I'm debating potentially splitting the FAQ up into separate pages per topic. The current single page is pretty long. Any opinions?

@ellbee
Copy link
Contributor

ellbee commented Sep 7, 2016

I do like having a list of links to all the questions on the Table of Contents. If we keep that I can't see that there are any downsides to splitting the topics onto different pages.

@markerikson
Copy link
Contributor Author

Yeah, I'd definitely keep FAQ.html to have the complete TOC, and then probably have a separate TOC within each page for just its entries.

@jimbolla
Copy link
Contributor

jimbolla commented Sep 7, 2016

The best way to organize them is probably whatever would produce the best results for someone doing a google search for a relevant question.

@markerikson
Copy link
Contributor Author

markerikson commented Oct 2, 2016

Starting in on this task. Plan is to go ahead and split it up based on the current categories, then update the existing questions, and finally write the new material.

@JeffBaumgardt
Copy link

I would like to know more about store enhancers. And injectable reducers for code splitting. The examples of both are quite limited and difficult to follow.

@markerikson
Copy link
Contributor Author

@Medros : Hmm. Both interesting topics, but maybe not so much "Frequently Asked Questions".

There was a good discussion about store enhancers on Twitter a few weeks ago: https://twitter.com/acemarke/status/778813095221170176 . Basically, they're semi-deliberately not called out in the docs right now since they're very much a power user feature, and there's some work in progress to change the internals related to them. The discussion at #1813 talks about them some, and the relevant rework issue is #1702 .

For injectable reducers, you might want to look at how https://github.com/mxstbr/react-boilerplate and https://github.com/davezuko/react-redux-starter-kit do things. There's also a variety of libraries related to component state and reducer management in my Redux addons list that may be relevant.

@markerikson
Copy link
Contributor Author

Good progress today. Split up the FAQ into separate pages per category, did about half of the planned updates to existing questions. I'll try to knock the rest out tomorrow.

@markerikson
Copy link
Contributor Author

And the "split+update" part is now in (see #2009 ).

I've got a few other things I'd like to do before tackling the new questions, so I'll leave this open for now. Probably come back to this in a couple weeks.

@bundance
Copy link

bundance commented Nov 8, 2016

Happy to help write some of these up for you. Any thoughts on the best place to start?

@markerikson
Copy link
Contributor Author

Hiya, and thanks!

In terms of how frequently stuff is actually asked, adding a new "Design Decisions" category would be most relevant. That said, that also jumps right into some fairly technical aspects.

An easier place to start might be adding a few new questions to the "General" section. The ideas I have listed at the moment are "When should I use Redux?", "What are the pros and cons of using Redux?", and "How does Redux compare to [Angular/Backbone/MobX]?".

That said, if there's a particular question that catches your eye, that works too. There's no particular deadline we're trying to hit, just a bunch of questions I've seen that I'd like to actually have covered in the FAQ.

I'm happy to work with you on what direction these answers should go, editing, and links to further info, I'm just primarily focused on writing a blog post series at the moment and trying to write the FAQ stuff myself is on the back burner for me until that's done.

@bundance
Copy link

bundance commented Nov 9, 2016

OK, that sounds good. Why don't I start with When/why to use Redux and Redux state vs React state. Do you want me to write a draft and add a new PR for you to review, or do you have some other process you prefer to use?

@markerikson
Copy link
Contributor Author

Ah... sorry, let me clarify what that first comment is trying to lay out.

My goal was to add additional links and info to existing questions, and then write new questions+answers. I've already finished everything under the "Updates to existing questions" heading, ie, the "add new links" part. It's the "write new questions+answers" part that I'm looking for help with at the moment.

The list of potential new questions is under the "New Topics" heading (starting with "When should I learn Redux?"). Anything listed under that section would be worth tackling.

As for workflow: you'd want to fork the Redux repo, create a branch, and start working on your drafts. Could probably post a link to the WIP file(s) here first, and then once you think you have a draft ready, file a PR.

@bundance
Copy link

bundance commented Nov 9, 2016

OK, I'll start with Do I have to use Immutable.js?. I've just finished writing a series of tutorials on Immutable, and I use it daily, so I'm very familiar with the issues surrounding its use.

@markerikson
Copy link
Contributor Author

Sounds good! The linked comment on Reddit is my own thoughts about some of the tradeoffs. I also just added pointers to the relevant sections of my React/Redux links list, on immutable data and React perf, as additional resources.

The "Immutable.js" question probably belongs in a new category, but not sure what that category should be at the moment. Maybe create an "Immutable Data" category for the moment in your branch, and start writing in that page?

@bundance
Copy link

@markerikson First PR is now ready for review: #2120

@maxhallinan
Copy link
Contributor

maxhallinan commented Jul 11, 2017

@markerikson I'm interested in working on this. Is it okay if I take the "Why use action creators?" item. Happy to start elsewhere if that is better for you.

@markerikson
Copy link
Contributor Author

@maxhallinan : yep, that'd be great! Go ahead and put together a draft for a new FAQ question, file a PR, and we can tweak it there. Thanks!

@Pk-T
Copy link

Pk-T commented Jul 15, 2017

@markerikson I am interested too, Is there something in your mind I can start with, which is also commonly required by the community?

@sbakkila
Copy link
Contributor

sbakkila commented Jul 24, 2017

@markerikson I made a PR for the FAQ section on design decisions #2528

@markerikson
Copy link
Contributor Author

@sbakkila : Great, thanks! I'll try to look at it tomorrow night or Wednesday.

@Fyre91 : sorry for not getting back to you faster. Anything up there in that list that hasn't been mentioned in the last few comments is fair game :) If you want a couple suggestions to start with, you could work on the "Updates to Existing Questions" items I have listed for the "one state tree" and "multiple dispatches" questions.

@maxhallinan
Copy link
Contributor

maxhallinan commented Jul 28, 2017

@markerikson I'm sorry this took so long. I've opened PR #2535 for "Why should I use action creators?"

@maxhallinan
Copy link
Contributor

I also opened PR #2537 to add links to the Actions FAQ section. FWIW, the other links that are listed for update in this issue description seem to be added already. Otherwise, I would have included them with this PR.

@maxhallinan
Copy link
Contributor

I was thinking of moving on to "When should I learn Redux?" Is this question specifically with regards to React? Otherwise, it seems that you should learn Redux when you should use Redux, which would overlap with the already answered "When should I use Redux?".

@markerikson
Copy link
Contributor Author

@maxhallinan : Eh, it's sort of in regards to React. And yeah, there's some overlap with "When should I use Redux?", but I think it's distinct enough to warrant its own FAQ entry.

@Pk-T
Copy link

Pk-T commented Jul 30, 2017

@markerikson OK i will take up one state tree performance FAQ.

@markerikson
Copy link
Contributor Author

@Fyre91 : cool, thanks!

@maxhallinan
Copy link
Contributor

@markerikson Ok, sounds good. I'm taking "When should I learn Redux?".

@sbakkila
Copy link
Contributor

sbakkila commented Aug 8, 2017

@markerikson I'm going to take 'Why use React-Redux' next.

@maxhallinan
Copy link
Contributor

@markerikson I'm taking the pagination/caching item under Performance next. Just to confirm, the actual question is "Can I cache paginated data without causing memory problems?"

@markerikson
Copy link
Contributor Author

@maxhallinan : roughly, yeah. The other trains of thought were maybe things like "How do I implement cache checks?", "How do I handle clearing cached data?", "How much can I safely cache in memory?", etc.

To be honest I don't remember exactly what I was thinking when I wrote that item, but that's what those links cover. I also just added a link to a great post on tracking subsets of normalized data.

This could easily turn into multiple separate question entries if we feel like it needs it, and I'm not as sure exactly what I want to see out of it. Take a stab at the topic, see what you come up with, and we'll work from there.

@markerikson
Copy link
Contributor Author

I just updated the list at the top of the thread to reflect what's been worked on recently. (Actually, y'know... I really shoulda made it a checkbox todo list from the start, instead of cutting and pasting completed stuff into a second section. Oh well.)

Great to see the list of stuff remaining getting smaller!

@gribnoysup
Copy link
Contributor

@markerikson Updates to Existing Questions: Performance is already in master :)

@maxhallinan
Copy link
Contributor

@markerikson "Why use action creators?" is also in master.

@markerikson
Copy link
Contributor Author

@gribnoysup , @maxhallinan : ah, yes, so they are :) Updated the list.

Definitely getting there. Looks like all the updates to existing questions are done, and there's just a few new items left.

@markerikson
Copy link
Contributor Author

Just came up with a new "Design Decisions" question: "Why does Redux separate out actions and updates?"

@timdorr
Copy link
Member

timdorr commented Feb 15, 2018

I think we're good on this. We can track individual FAQ updates in other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests