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
`createFactory` was deprecated in [February 202 (v16.13.0)](https://legacy.reactjs.org/blog/2020/02/26/react-v16.13.0.html#deprecating-createfactory).
211
+
`createFactory` was deprecated in [February 2020 (v16.13.0)](https://legacy.reactjs.org/blog/2020/02/26/react-v16.13.0.html#deprecating-createfactory).
212
212
213
213
Using `createFactory` was common before broad support for JSX, but it's rarely used today and can be replaced with JSX. In React 19, we're removing `createFactory` and you'll need to migrate to JSX:
In React 18, we updated `react-test-renderer/shallow` to reexport [react-shallow-renderer](https://github.com/enzymejs/react-shallow-renderer). In React 19, we're removing `react-test-render/shallow` to prefer installing the package directly:
230
230
231
+
```bash
232
+
npm install react-shallow-renderer --save-dev
233
+
```
234
+
```diff
235
+
- import ShallowRenderer from 'react-test-renderer/shallow';
236
+
+ import ShallowRenderer from 'react-shallow-renderer';
Shallow rendering depends on React internals and can block you from future upgrades. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started).
236
244
245
+
</Note>
237
246
238
247
## Removing deprecated React DOM APIs {/*removing-deprecated-react-dom-apis*/}
We've moved `act` from `react-dom/test-utils` to the `react` package:
252
+
253
+
<ConsoleBlockMulti>
254
+
255
+
<ConsoleLogLinelevel="error">
256
+
257
+
`ReactDOMTestUtils.act` is deprecated in favor of `React.act`. Import `act` from `react` instead of `react-dom/test-utils`. See https://react.dev/warnings/react-dom-test-utils for more info.
258
+
259
+
</ConsoleLogLine>
260
+
261
+
</ConsoleBlockMulti>
262
+
263
+
To fix this warning, you can import `act` from `react`:
264
+
265
+
```diff
266
+
- import {act} from 'react-dom/test-utils'
267
+
+ import {act} from 'react';
268
+
```
269
+
270
+
All other `test-utils` functions have been removed. These utilities were uncommon, and made it too easy to depend on low level implementation details of your components and React. In React 19, these functions will error when called and their exports will be removed in a future version.
271
+
272
+
See the [warning page](https://react.dev/warnings/react-dom-test-utils) to for alternatives.
We are deprecating `react-test-renderer` because it implements its own renderer environment that doesn't match the environment users use, promotes testing implementation details, and relies on introspection of React's internals.
339
+
340
+
The test renderer was created before there were more viable testing strategies available like [React Testing Library](https://testing-library.com), and we now recommend using a modern testing library instead.
341
+
342
+
In React 19, `react-test-renderer` log a deprecation warning, and has switched to concurrent rendering by default. We recommend migrating your tests to [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/) or [@testing-library/react-native](https://callstack.github.io/react-native-testing-library/docs/getting-started) for a modern and well supported testing experience.
343
+
344
+
311
345
312
346
## Other Breaking Changes {/*other-breaking-changes*/}
313
347
314
348
- UMD builds have been removed
349
+
- react: Warn when using defaultProps in functions, memo, lazy, and forwardRef (TODO)
350
+
- react: Warn when spreading “key” as part of props in DEV (TODO)
315
351
- react-dom: Remove `errorInfo.digest` with warning (TODO)
0 commit comments