reactjs / reactjs/react.dev

Document Controlled vs Uncontrolled Component Design pattern

Open
#918 14 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

pursuant to this discussion https://twitter.com/dan_abramov/status/1001943857096003584

all react components can be:

  • controlled (no internal state)
  • uncontrolled (internal state)
  • mixed (uncontrolled by default, unless some props are passed to make it controlled)

the current docs on controlled vs uncontrolled: https://reactjs.org/docs/uncontrolled-components.html focus entirely on forms, but this design pattern applies to -all- components. we should document this.

questions

  1. What else should we say in the docs?
  2. do we want to tell people that they can do "mixed control" or do we leave that for people to discover for themselves?
  3. is this the same page as https://reactjs.org/docs/uncontrolled-components.html or is it a separate page?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing uncontrolled-components.html documentation and the linked discussion. Resolve whether controlled, uncontrolled, and mixed component patterns belong on that page or a separate page, and determine the guidance the documentation should provide. Done means the selected documentation clearly covers the pattern beyond forms and answers the open scope questions.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.