Gathering detailed insights and metrics for react-redux-lifecycle
Gathering detailed insights and metrics for react-redux-lifecycle
Gathering detailed insights and metrics for react-redux-lifecycle
Gathering detailed insights and metrics for react-redux-lifecycle
react-redux-connect-lifecycle
A higher-order component to connect a React component to a redux store with component 'mount' lifecycle events
async-lifecycle-hooks
React hooks accompanying the async-lifecycle-saga library
lifecycle-connector
React-redux injector with react lifecycle events
react-redux-lifecycles
Store lifecycles methods for connected component
A higher-order component to dispatch actions on react lifecycle methods
npm install react-redux-lifecycle
Typescript
Module System
Node Version
NPM Version
JavaScript (91.22%)
TypeScript (8.78%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
19 Stars
29 Commits
1 Forks
3 Watchers
1 Branches
1 Contributors
Updated on Dec 07, 2022
Latest Version
2.2.0
Package Id
react-redux-lifecycle@2.2.0
Unpacked Size
23.96 kB
Size
5.43 kB
File Count
10
NPM Version
5.5.1
Node Version
8.9.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
3
30
Often, actions need to be dispatched as part of the React lifecycle. In many cases, the only reason to extend React.Component
instead of using functional components is to do this.
Well, no more! Now you can just wrap your component in this higher-order component and remain in your functional bliss.
1npm install --save react-redux-lifecycle
This assumes that you’re using npm package manager with a module bundler like Webpack or Browserify to consume CommonJS modules.
1import { withLifecycleActions } from 'react-redux-lifecycle' 2 3const myAction = { type: 'MY_ACTION' } 4 5const MyComponent = ({ message }) => <div>{message}</div> 6 7export default withLifecycleActions({ componentDidMount: myAction })(MyComponent) 8 9... 10 11import MyComponent from './MyComponent' 12 13<MyComponent message="Hello World!" />
1import { withLifecycleActions } from 'react-redux-lifecycle' 2 3const myActionCreator = () => ({ type: 'MY_ACTION' }) 4 5const MyComponent = ({ message }) => <div>{message}</div> 6 7export default withLifecycleActions({ componentDidMount: myActionCreator })(MyComponent) 8 9... 10 11import MyComponent from './MyComponent' 12 13<MyComponent message="Hello World!" />
The component props are passed to any functions that are provided
1import { withLifecycleActions } from 'react-redux-lifecycle' 2 3const myActionCreator = ({ id }) => ({ type: 'MY_ACTION', id }) 4 5const MyComponent = ({ message }) => <div>{message}</div> 6 7export default withLifecycleActions({ componentDidMount: myActionCreator })(MyComponent) 8 9... 10 11import MyComponent from './MyComponent' 12 13<MyComponent id={123} message="Hello World!" />
1import { withLifecycleActions } from 'react-redux-lifecycle' 2 3const myAction = () => { type: 'MY_ACTION' } 4const myActionCreator = () => myAction 5 6const MyComponent = ({ message }) => <div>{message}</div> 7 8export default withLifecycleActions({ componentDidMount: [myAction, myActionCreator] })(MyComponent) 9 10... 11 12import MyComponent from './MyComponent' 13 14<MyComponent message="Hello World!" />
Helper functions are available if you only need to dispatch the action on a single lifecycle method.
1import { onComponentDidMount } from 'react-redux-lifecycle' 2 3const myAction = { type: 'MY_ACTION' } 4 5const MyComponent = ({ message }) => <div>{message}</div> 6 7export default onComponentDidMount(myAction)(MyComponent) 8 9... 10 11import MyComponent from './MyComponent' 12 13<MyComponent message="Hello World!" />
Basic action, action creators and multiple actions are all supported in the same manner as withLifecycleActions
.
The following lifecycle methods are supported:
componentWillMount
(helper: onComponentWillMount
)componentDidMount
(helper: onComponentDidMount
)componentWillReceiveProps
(helper: onComponentWillReceiveProps
)componentWillUpdate
(helper: onComponentWillUpdate
)componentDidUpdate
(helper: onComponentDidUpdate
)componentWillUnmount
(helper: onComponentWillUnmount
)componentDidCatch
(helper: onComponentDidCatch
)No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/29 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
81 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More