Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
"eslint-plugin-react": "^7.34.2",
"jsdom": "^25.0.1",
"prettier": "^3.3.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"redux": "^5.0.1",
"rimraf": "^5.0.7",
"tsup": "^8.3.5",
Expand Down
36 changes: 34 additions & 2 deletions src/components/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ export interface ConnectOptions<
}

/**

*
* Connects a React component to a Redux store.
*
* - Without arguments, just wraps the component, without changing the behavior / props
Expand Down Expand Up @@ -415,6 +417,16 @@ export interface Connect<DefaultState = unknown> {
let hasWarnedAboutDeprecatedPureOption = false

/**
* @deprecated
*
* **We recommend using the `useSelector` and `useDispatch` hooks instead.**
* See https://react-redux.js.org/api/hooks
*
* If you need to use `connect` without this visual deprecation warning,
* import `legacy_connect` instead:
*
* `import { legacy_connect as connect } from 'react-redux'`
*
* Connects a React component to a Redux store.
*
* - Without arguments, just wraps the component, without changing the behavior / props
Expand All @@ -434,7 +446,7 @@ let hasWarnedAboutDeprecatedPureOption = false
* @param options Options for configuring the connection
*
*/
function connect<
function _connect<
TStateProps = {},
TDispatchProps = {},
TOwnProps = {},
Expand Down Expand Up @@ -810,4 +822,24 @@ function connect<
return wrapWithConnect
}

export default connect as Connect
/**
* * @deprecated
*
* **We recommend using the `useSelector` and `useDispatch` hooks instead.**
* See https://react-redux.js.org/api/hooks
*
* If you need to use `connect` without this visual deprecation warning,
* import `legacy_connect` instead:
*
* `import { legacy_connect as connect } from 'react-redux'`
*/
export const connect: Connect = _connect as Connect

/**
* Connects a React component to a Redux store. Same as `connect` but without
* the deprecation warning.
*
* **We recommend using the `useSelector` and `useDispatch` hooks instead.**
* See https://react-redux.js.org/api/hooks
*/
export const legacy_connect: Connect = _connect as Connect
4 changes: 2 additions & 2 deletions src/exports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import connect from './components/connect'
import { connect, legacy_connect } from './components/connect'
export type {
Connect,
ConnectProps,
Expand Down Expand Up @@ -48,4 +48,4 @@ export * from './types'
*/
const batch = defaultNoopBatch

export { Provider, batch, connect, shallowEqual }
export { Provider, batch, connect, legacy_connect, shallowEqual }
1 change: 1 addition & 0 deletions src/index-rsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
throwNotSupportedError as Provider,
throwNotSupportedError as batch,
throwNotSupportedError as connect,
throwNotSupportedError as legacy_connect,
throwNotSupportedError as createDispatchHook,
throwNotSupportedError as createSelectorHook,
throwNotSupportedError as createStoreHook,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/ssr.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ describe('New v8 serverState behavior', () => {
expect(consoleErrorSpy).toHaveBeenCalledOnce()

expect(errorArg.message).toMatch(
/Hydration failed because the server rendered HTML didn't match the client/,
/Hydration failed because the server rendered (HTML|text) didn't match the client/,
)
} else if (IS_REACT_18) {
expect(consoleErrorSpy).toHaveBeenCalledTimes(8)
Expand Down
32 changes: 16 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4826,14 +4826,14 @@ __metadata:
languageName: node
linkType: hard

"react-dom@npm:^19.0.0":
version: 19.0.0
resolution: "react-dom@npm:19.0.0"
"react-dom@npm:^19.2.0":
version: 19.2.3
resolution: "react-dom@npm:19.2.3"
dependencies:
scheduler: "npm:^0.25.0"
scheduler: "npm:^0.27.0"
peerDependencies:
react: ^19.0.0
checksum: 10/aa64a2f1991042f516260e8b0eca0ae777b6c8f1aa2b5ae096e80bbb6ac9b005aef2bca697969841d34f7e1819556263476bdfea36c35092e8d9aefde3de2d9a
react: ^19.2.3
checksum: 10/5780f6d4c8e8ece09f82c5500ba2d55e01c30b5273f9281734d7d3b65013cd1fa52ec4e4436e5248c0a9e5bc340836044051168bbad8d7eac4d33ee6c2a867a1
languageName: node
linkType: hard

Expand Down Expand Up @@ -4882,8 +4882,8 @@ __metadata:
eslint-plugin-react: "npm:^7.34.2"
jsdom: "npm:^25.0.1"
prettier: "npm:^3.3.3"
react: "npm:^19.0.0"
react-dom: "npm:^19.0.0"
react: "npm:^19.2.0"
react-dom: "npm:^19.2.0"
redux: "npm:^5.0.1"
rimraf: "npm:^5.0.7"
tsup: "npm:^8.3.5"
Expand All @@ -4903,10 +4903,10 @@ __metadata:
languageName: unknown
linkType: soft

"react@npm:^19.0.0":
version: 19.0.0
resolution: "react@npm:19.0.0"
checksum: 10/2490969c503f644703c88990d20e4011fa6119ddeca451e9de48f6d7ab058d670d2852a5fcd3aa3cd90a923ab2815d532637bd4a814add402ae5c0d4f129ee71
"react@npm:^19.2.0":
version: 19.2.3
resolution: "react@npm:19.2.3"
checksum: 10/d16b7f35c0d35a56f63d9d1693819762e4abc479c57dd6310298920bed3820fcec7e17a99d44983416d8f5049143ea45b8005d3ab8324bae8973224400502b08
languageName: node
linkType: hard

Expand Down Expand Up @@ -5248,10 +5248,10 @@ __metadata:
languageName: node
linkType: hard

"scheduler@npm:^0.25.0":
version: 0.25.0
resolution: "scheduler@npm:0.25.0"
checksum: 10/e661e38503ab29a153429a99203fefa764f28b35c079719eb5efdd2c1c1086522f6653d8ffce388209682c23891a6d1d32fa6badf53c35fb5b9cd0c55ace42de
"scheduler@npm:^0.27.0":
version: 0.27.0
resolution: "scheduler@npm:0.27.0"
checksum: 10/eab3c3a8373195173e59c147224fc30dabe6dd453f248f5e610e8458512a5a2ee3a06465dc400ebfe6d35c9f5b7f3bb6b2e41c88c86fd177c25a73e7286a1e06
languageName: node
linkType: hard

Expand Down