Gathering detailed insights and metrics for connected-next-router
Gathering detailed insights and metrics for connected-next-router
Gathering detailed insights and metrics for connected-next-router
Gathering detailed insights and metrics for connected-next-router
A Redux binding for Next.js Router compatible with Next.js.
npm install connected-next-router
Typescript
Module System
Node Version
NPM Version
TypeScript (76.56%)
JavaScript (23.44%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
110 Stars
148 Commits
29 Forks
5 Watchers
19 Branches
6 Contributors
Updated on Dec 05, 2024
Latest Version
5.0.0
Package Id
connected-next-router@5.0.0
Unpacked Size
50.08 kB
Size
10.05 kB
File Count
54
NPM Version
9.8.1
Node Version
18.18.2
Published on
Nov 04, 2023
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
4
23
v5.0.0 requires Next.js 10 or newer, React Redux 7.1.0 or newer, and React 16.8.0 or newer. If you are using Next.js 9, check out v3 branch. If you are using Next.js 7-8, check out v0 branch.
A Redux binding for Next.js Router compatible with Next.js.
:sparkles: Keep Router state in sync with your Redux store.
:tada: Dispatch Router methods (push
, replace
, go
, goBack
, goForward
, prefetch
) using Redux actions.
:clock9: Support time traveling in Redux DevTools.
:gem: Ease migration to next.js framework from codebases using connected-react-router or react-router-redux (see migration guide).
Using npm:
$ npm install --save connected-next-router
Or yarn:
$ yarn add connected-next-router
routerReducer
to your root reducer.createRouterMiddleware
if you want to dispatch Router actions (ex. to change URL with push('/home')
).initialRouterState(url)
to populate router state in the server side.1// store/configure-store.js 2import { createStore, applyMiddleware, combineReducers } from 'redux' 3import { createRouterMiddleware, initialRouterState, routerReducer } from 'connected-next-router' 4import { HYDRATE, createWrapper } from 'next-redux-wrapper' 5import Router from 'next/router' 6 7const rootReducer = combineReducers({ 8 // Add other reducers 9 router: routerReducer 10}); 11 12const routerMiddleware = createRouterMiddleware(); 13 14// Using next-redux-wrapper's initStore 15const reducer = (state, action) => { 16 if (action.type === HYDRATE) { 17 const nextState = { 18 ...state, // use previous state 19 ...action.payload, // apply delta from hydration 20 } 21 if (typeof window !== 'undefined' && state?.router) { 22 // preserve router value on client side navigation 23 nextState.router = state.router 24 } 25 return nextState 26 } else { 27 return rootReducer(state, action) 28 } 29} 30 31export const initStore = (context) => { 32 const routerMiddleware = createRouterMiddleware() 33 const { asPath } = context.ctx || Router.router || {} 34 let initialState 35 if (asPath) { 36 initialState = { 37 router: initialRouterState(asPath) 38 } 39 } 40 return createStore(reducer, initialState, applyMiddleware(routerMiddleware)) 41} 42 43export const wrapper = createWrapper(initStore)
ConnectedRouter
as children of react-redux
's Provider
.1// pages/_app.js 2import App from 'next/app' 3import { ConnectedRouter } from 'connected-next-router' 4import { wrapper } from '../store/configure-store' 5 6class ExampleApp extends App { 7 render() { 8 const { Component, pageProps } = this.props 9 return ( 10 <ConnectedRouter> 11 <Component {...pageProps} /> 12 </ConnectedRouter> 13 ) 14 } 15} 16 17// wrapper.withRedux wraps the App with react-redux's Provider 18export default wrapper.withRedux(ExampleApp)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 3/11 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
76 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