reactjs / reactjs/react.dev

Incomplete documentation on creating web components

Open
#72 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

difficulty: beginner in-progress type: documentation
Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

This issue was originally reported by @LukasBombach via facebook/react/issues/10155

Text of original issue:

your documentation on creating web components with react is quite cool and works really nice for the html. However, any component created this way will be unstyled as the documentation does not cover how to add CSS to the web component. Using create-react-app all your CSS will end up in a main.hash.css file and have selectors for your components, but when you create a web component, you css must be encapsulated in the component as the the components DOM lives in the shadow root and is not stylable from outside.

It would be cool if you could show a way to account for this.

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 by reading the linked web components documentation and reviewing how the current React documentation organizes this topic. Update the guidance to explain how CSS can be encapsulated for components rendered in a shadow root, with an example that accounts for create-react-app's generated stylesheet; the documentation should clearly cover both markup and styling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.