From 2ac1279a0a8039350c859005ecec1ff2f6376ef6 Mon Sep 17 00:00:00 2001 From: Vivek JM <24496671+vivekjm@users.noreply.github.com> Date: Sat, 6 Jun 2026 17:27:47 +0530 Subject: [PATCH] docs: mention createReactClass derived state --- src/content/reference/react/Component.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/reference/react/Component.md b/src/content/reference/react/Component.md index 3b882f09762..83ea1a5de33 100644 --- a/src/content/reference/react/Component.md +++ b/src/content/reference/react/Component.md @@ -1013,6 +1013,8 @@ Deriving state leads to verbose code and makes your components difficult to thin - This method doesn't have access to the component instance. If you'd like, you can reuse some code between `static getDerivedStateFromProps` and the other class methods by extracting pure functions of the component props and state outside the class definition. +- If your legacy component is defined with [`createReactClass`](https://legacy.reactjs.org/docs/react-without-es6.html), define `getDerivedStateFromProps` in the `statics` object. + Implementing `static getDerivedStateFromProps` in a class component is equivalent to [calling the `set` function from `useState` during rendering](/reference/react/useState#storing-information-from-previous-renders) in a function component.