@@ -249,6 +249,8 @@ export interface ConnectOptions<
249249}
250250
251251/**
252+
253+ *
252254 * Connects a React component to a Redux store.
253255 *
254256 * - Without arguments, just wraps the component, without changing the behavior / props
@@ -415,6 +417,16 @@ export interface Connect<DefaultState = unknown> {
415417let hasWarnedAboutDeprecatedPureOption = false
416418
417419/**
420+ * @deprecated
421+ *
422+ * **We recommend using the `useSelector` and `useDispatch` hooks instead.**
423+ * See https://react-redux.js.org/api/hooks
424+ *
425+ * If you need to use `connect` without this visual deprecation warning,
426+ * import `legacy_connect` instead:
427+ *
428+ * `import { legacy_connect as connect } from 'react-redux'`
429+ *
418430 * Connects a React component to a Redux store.
419431 *
420432 * - Without arguments, just wraps the component, without changing the behavior / props
@@ -434,7 +446,7 @@ let hasWarnedAboutDeprecatedPureOption = false
434446 * @param options Options for configuring the connection
435447 *
436448 */
437- function connect <
449+ function _connect <
438450 TStateProps = { } ,
439451 TDispatchProps = { } ,
440452 TOwnProps = { } ,
@@ -810,4 +822,26 @@ function connect<
810822 return wrapWithConnect
811823}
812824
813- export default connect as Connect
825+ /**
826+ * * @deprecated
827+ *
828+ * **We recommend using the `useSelector` and `useDispatch` hooks instead.**
829+ * See https://react-redux.js.org/api/hooks
830+ *
831+ * If you need to use `connect` without this visual deprecation warning,
832+ * import `legacy_connect` instead:
833+ *
834+ * `import { legacy_connect as connect } from 'react-redux'`
835+ */
836+ export const connect : Connect = _connect as Connect
837+
838+ interface LegacyConnect extends Connect { }
839+
840+ /**
841+ * Connects a React component to a Redux store. Same as `connect` but without
842+ * the deprecation warning.
843+ *
844+ * **We recommend using the `useSelector` and `useDispatch` hooks instead.**
845+ * See https://react-redux.js.org/api/hooks
846+ */
847+ export const legacy_connect : Connect = _connect as Connect
0 commit comments