react: Bug: "The above error…" should appear after the error message but appears before (for some errors)
React version: both latest (17.0.2) and next (18.0.0-alpha-9c8161ba8-20211028)
Steps To Reproduce
- Render
<input>hello</input>to trigger the “input is a void element tag” error
Link to code example: https://codesandbox.io/s/cocky-matan-ydmys
The current behavior
Two log lines appear:
- “The above error occurred in the <input> component”
- “input is a void element tag”

The expected behavior
They should be in the other order:
- “input is a void element tag”
- “The above error occurred in the <input> component”
This problem doesn’t occur in the same way if a component throws an error. Presumably this goes through a different error handling path because it comes from the host config.
If someone works on this, you may also want to review look at this issue at the same time:
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 8
- Comments: 18
Hi @aniler0 – I’m aware. 😃 But when someone makes this mistake, the reporting of the error should be a little different than it is today, and that’s what this bug is about.
The input tag should be a self closing tag
Still happens on next (18.3.0-next-4fcc9184a-20230217): https://codesandbox.io/s/stoic-hermann-x1kwd2
Hi @MustafaEminn, If you already have worked on this issue then you can surely write a patch for this, I will try to learn from your patch.