react icon indicating copy to clipboard operation
react copied to clipboard

[New Docs] Wanted Guides

Open gaearon opened this issue 10 years ago • 53 comments

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 cloneElement and Children https://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 setState with 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!

gaearon avatar Oct 23 '16 13:10 gaearon

cc @lacker @hramos @ericnakagawa

gaearon avatar Oct 23 '16 13:10 gaearon

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.

mrscobbler avatar Oct 23 '16 23:10 mrscobbler

I can possibly take routing with HTML5 history

jamesknelson avatar Oct 23 '16 23:10 jamesknelson

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).

gaearon avatar Oct 24 '16 00:10 gaearon

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.

jamesknelson avatar Oct 24 '16 00:10 jamesknelson

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.

gaearon avatar Oct 24 '16 00:10 gaearon

Actually, it shouldn't need context if we're just using plain HTML5 history. I was thinking of using the history package.

jamesknelson avatar Oct 24 '16 00:10 jamesknelson

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.

gaearon avatar Oct 24 '16 00:10 gaearon

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?

jamesknelson avatar Oct 24 '16 00:10 jamesknelson

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.

gaearon avatar Oct 24 '16 00:10 gaearon

Ok. Will put a draft together probably this weekend :)

jamesknelson avatar Oct 24 '16 00:10 jamesknelson

I'm writing a guide on ajax. Is that good with people or is someone already on it?

rthor avatar Oct 25 '16 18:10 rthor

Is anyone working on Manipulating Children #6942 or can I take it?

madhug avatar Oct 29 '16 16:10 madhug

@madhug Assigned to you, thanks!

gaearon avatar Oct 29 '16 17:10 gaearon

@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?

jamesknelson avatar Oct 30 '16 11:10 jamesknelson

OK, using history seems reasonable with a note that it hides browser inconsistencies.

gaearon avatar Oct 31 '16 12:10 gaearon

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.

laumair avatar Nov 01 '16 22:11 laumair

Yeah, been working on it (#8098). Just awaiting final review. Any news on getting it merged @gaearon ? :p

rthor avatar Nov 01 '16 23:11 rthor

@rthor Ah, okay. Is there any other stuff that's left from the checklist?

laumair avatar Nov 02 '16 05:11 laumair

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?

brillout avatar Nov 02 '16 18:11 brillout