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
return`Declare this component outside parent component "${parentName}" or memoize it.`;
30
+
return`Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component${parentName ? ` “${parentName}” ` : ' '}and pass data as props.`;
Copy file name to clipboardExpand all lines: tests/lib/rules/no-unstable-nested-components.js
+70-2
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,8 @@ const parserOptions = {
22
22
},
23
23
};
24
24
25
-
constERROR_MESSAGE='Declare this component outside parent component "ParentComponent" or memoize it.';
26
-
constERROR_MESSAGE_WITHOUT_NAME='Declare this component outside parent component or memoize it.';
25
+
constERROR_MESSAGE='Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “ParentComponent” and pass data as props.';
26
+
constERROR_MESSAGE_WITHOUT_NAME='Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component and pass data as props.';
27
27
constERROR_MESSAGE_COMPONENT_AS_PROPS=`${ERROR_MESSAGE} If you want to allow component creation in props, set allowAsProps option to true.`;
0 commit comments