Skip to content

Instantly share code, notes, and snippets.

@jesperorb
Last active Aug 31, 2017
Embed
What would you like to do?
Common Errors in React

Common Errors in React

Unterminated JSX Content

Don't focus on which element the cursor is pointing, just look for any element that hasn't been closed

Error

Unterminated JSX Content

Solution

Terminate JSX Content

JSX Element must be wrapped in enclosing tag

You are returning more that one element or component, wrap your components in a surrounding element Wrapped tag

Wrong

Wrapped Tag wrong

Right

Wrapped tag right

Missing key for element

Your looped element or component is missing key, just add some kind of key to the element.

Key property

Wrong

Key Property

Partially right

Index can be used as a key, not recommended but a simple solution

Key property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment