You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When returning a JSX element from a loader and rendering it in a named export component, a key prop warning appears in the console. The warning disappears when the component is changed to a default export — with no other changes.
Steps to reproduce
Step 1. Return a JSX element from a loader:
exportasyncfunctionloader(){return{message: 'Message from the server!',element: <p>Element from the server!</p>,}}
Step 2. Render it inside a named export component:
Alternatively, adding an explicit key prop to the element returned from the loader also suppresses the warning.
Question
Is this behavior intentional? Should JSX elements passed through a loader always require an explicit key, or is the named-export path not yet fully supported for RSC?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Environment
React Router v7.14.2, Framework mode, RSC enabled
Description
When returning a JSX element from a loader and rendering it in a named export component, a key prop warning appears in the console. The warning disappears when the component is changed to a default export — with no other changes.
Steps to reproduce
Step 1. Return a JSX element from a loader:
Step 2. Render it inside a named export component:
Result: A key prop warning appears in the console.
Workaround
Changing the component to a default export makes the warning go away:
Alternatively, adding an explicit key prop to the element returned from the loader also suppresses the warning.
Question
Is this behavior intentional? Should JSX elements passed through a loader always require an explicit key, or is the named-export path not yet fully supported for RSC?
Beta Was this translation helpful? Give feedback.
All reactions