[New Docs] Wanted Guides
We revamped the docs, but there are a few guides that are missing and that I think are essential.
- [ ] Community section with good resources (e.g. https://github.com/facebook/react/pull/7117)
- [ ] @mrscobbler Glossary (similar to "Virtual DOM Terminology" that is now gone, but more friendly. Check http://redux.js.org/docs/Glossary.html for inspiration.)
- [ ] Troubleshooting (there are ~5 common issues we should explain right away, like wrong element casing, not loaded DOM container, missing React in scope, etc. See http://redux.js.org/docs/Troubleshooting.html for inspiration)
- [ ] Accessibility
- [ ] @madhug Manipulating Children (Using
cloneElementandChildrenhttps://github.com/facebook/react/issues/6942) - [ ] "Portals" (useful for modals)
- [ ] Animation with React Motion
- [ ] @jamesknelson Routing (no need to use React Router here, just show how to use
setStatewith HTML5 history API and point to RR as a component-based API for it once v4 is out) - [ ] AJAX (just show how to use
fetch()in lifecycles, mention cancellation issues) - [x] Integrating with non-React code (show how to wrap jQuery plugin in React, how to expose React component as a Backbone view, and how to consume Backbone models) https://github.com/facebook/react/pull/9316#pullrequestreview-30403084
- [ ] ReactPerf should include a basic usage example, not just reference (https://github.com/facebook/react/issues/6174)
- [ ] Snapshot testing (https://github.com/facebook/react/issues/7431)
- [ ] Publishing a Component (https://github.com/facebook/react/issues/7882)
If somebody wants to work on this please comment here and let's figure out a plan. Help wanted!
cc @lacker @hramos @ericnakagawa
I'll take the glossary sections. Is there a list of terms somewhere I can work of off? Or should I come up with some? I don't remember what the virtual DOM terminology page contained.
I can possibly take routing with HTML5 history
Regarding terminology, please assume familiarity with all topics in "Basic Guides". Most of them have relevant terms right in titles (elements, components, props, state, lifecycle, events, keys).
Does the routing guide even need to use setState? I think it should be possible to do with plain props. Also, will hash-based routing be OK? If not, it'll probably need context to make a <Link> component work which seems a little complicated.
If we do plain props we'll have to make top level render inside a change handler right? I'd like to avoid that because people often don't understand how to compose two such handlers.
I think we should teach HTML5 routing right away. Like here: https://vuejs.org/guide/routing.html. Would you really need context? You can have Link listen to history independently.
Actually, it shouldn't need context if we're just using plain HTML5 history. I was thinking of using the history package.
I want to keep it package free so people see the simplicity of doing routing with React, and then go to packages when they actually need their features.
Yes, that is the definitely ideal. Was a thinking mistake on my part.
So just to confirm, the idea is to add a listener in componentWillMount of a Router component, use setState based on that, then choose what to render based on state? Then create a Link component which captures onClick and does pushState?
Maybe not even call it Router, just make a top level App component choose the right thing based on state and a URL => component map object or something like that.
Ok. Will put a draft together probably this weekend :)
I'm writing a guide on ajax. Is that good with people or is someone already on it?
Is anyone working on Manipulating Children #6942 or can I take it?
@madhug Assigned to you, thanks!
@gaearon I've started putting the routing guide together, but the HTML5 History API is a little less nice than I had imagined.
First, browser's don't emit the popstate event when pushState is called. This means <Link> components will need some way of notifying the <App> component of any changes -- e.g. context or a shared global. Second, Safari doesn't emit popstate on page load, while other browsers do.
While I have no problem with explaining these things, it would end up being a guide to HTML5 History instead of a guide to React Routing. Would it be ok to use the hashchange event instead, or possibly history?
Also should I create a separate issue for this?
OK, using history seems reasonable with a note that it hides browser inconsistencies.
Is anyone working on AJAX (just show how to use fetch() in lifecycles, mention cancellation issues). I'd like to take this on. I might have a few questions though before getting started.
Yeah, been working on it (#8098). Just awaiting final review. Any news on getting it merged @gaearon ? :p
@rthor Ah, okay. Is there any other stuff that's left from the checklist?
I maintain a catalog of components/libraries: brillout/awesome-react-components / devarchy.com/react-components. Maybe it could make sense to mention the catalog in the doc?