Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consolidate entry points #1761

Merged
merged 3 commits into from
Jul 8, 2021
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"repository": "github:reduxjs/react-redux",
"bugs": "https://github.com/reduxjs/react-redux/issues",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"types": "./es/index.d.ts",
"unpkg": "dist/react-redux.js",
"module": "es/index.js",
"files": [
Expand Down
26 changes: 0 additions & 26 deletions src/alternate-renderers.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/alternate-renderers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from './exports'

import { getBatch } from './utils/batch'

// For other renderers besides ReactDOM and React Native,
// use the default noop batch function
const batch = getBatch()

export { batch }
61 changes: 61 additions & 0 deletions src/exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Provider from './components/Provider'
import type { ProviderProps } from './components/Provider'
import connectAdvanced from './components/connectAdvanced'
import type {
ConnectAdvancedOptions,
ConnectProps,
} from './components/connectAdvanced'
import type {
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
} from './connect/selectorFactory'
import { ReactReduxContext } from './components/Context'
import type { ReactReduxContextValue } from './components/Context'
import connect from './connect/connect'

import { useDispatch, createDispatchHook } from './hooks/useDispatch'
import { useSelector, createSelectorHook } from './hooks/useSelector'
import { useStore, createStoreHook } from './hooks/useStore'

import shallowEqual from './utils/shallowEqual'

export * from './types'
export type {
ProviderProps,
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
ConnectProps,
ConnectAdvancedOptions,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
ReactReduxContextValue,
}
export {
Provider,
connectAdvanced,
ReactReduxContext,
connect,
useDispatch,
createDispatchHook,
useSelector,
createSelectorHook,
useStore,
createStoreHook,
shallowEqual,
}
66 changes: 5 additions & 61 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,10 @@
import Provider from './components/Provider'
import type { ProviderProps } from './components/Provider'
import connectAdvanced from './components/connectAdvanced'
import type {
ConnectAdvancedOptions,
ConnectProps,
} from './components/connectAdvanced'
import type {
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
} from './connect/selectorFactory'
import { ReactReduxContext } from './components/Context'
import type { ReactReduxContextValue } from './components/Context'
import connect from './connect/connect'
export * from './exports'

import { useDispatch, createDispatchHook } from './hooks/useDispatch'
import { useSelector, createSelectorHook } from './hooks/useSelector'
import { useStore, createStoreHook } from './hooks/useStore'

import { setBatch } from './utils/batch'
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'
import shallowEqual from './utils/shallowEqual'
import { setBatch } from './utils/batch'

// Enable batched updates in our subscriptions for use
// with standard React renderers (ReactDOM, React Native)
setBatch(batch)

export * from './types'
export type {
ProviderProps,
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
ConnectProps,
ConnectAdvancedOptions,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
ReactReduxContextValue,
}
export {
Provider,
connectAdvanced,
ReactReduxContext,
connect,
batch,
useDispatch,
createDispatchHook,
useSelector,
createSelectorHook,
useStore,
createStoreHook,
shallowEqual,
}
export { batch }
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"jsx": "react",
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./lib",
"outDir": "./es",
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*", "types"],
Expand Down