reactjs / reactjs/react.dev

Using empty string to prevent updating of dangerouslySetInnerHTML?

Open
#2,363 1 comment 3 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

From @sebmarkbage's comment over in the React repo it sounds like dangerouslySetInnerHTML doesn't update the underlying DOM if it receives an empty string. I could also reproduce this: https://repl.it/repls/MotherlyPuzzlingComma

That's useful behavior for us in a server-rendering context where we don't need to ship the HTML to the client. But before merging that PR, I want to make sure this behavior is intended and not going away silently. And if so, should we maybe document it on the website?

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 reviewing the linked React issue comment, the repro, and the referenced mozilla/kuma pull request to establish whether empty dangerouslySetInnerHTML is intended behavior. Done means confirming the behavior and deciding whether it should be documented on the React documentation website.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.