Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-simple-router

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-simple-router - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

8

lib/index.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -36,3 +36,3 @@ // constants

function locationToString(location) {
return location.pathname + (location.search ? '?' + location.search : '') + (location.hash ? '#' + location.hash : '');
return location.pathname + location.search + location.hash;
}

@@ -55,3 +55,3 @@

var routing = store.getState().routing;
// Don't update the router is nothing has changed. The
// Don't update the router if nothing has changed. The
// `avoidRouterUpdate` flag can be set to avoid updating altogether,

@@ -61,3 +61,3 @@ // which is useful for things like loading snapshots or very special

if (routing.path !== locationToString(window.location) && !routing.noRouterUpdate) {
history.pushState(null, routeState.path);
history.pushState(null, routing.path);
}

@@ -64,0 +64,0 @@ });

{
"name": "redux-simple-router",
"version": "0.0.6",
"description": "Ruthlessly simple bindings to keep react-router and redux in sync",
"version": "0.0.7",
"description": "Ruthlessly simple bindings to keep react-router and redux in syncy",
"main": "lib/index",

@@ -6,0 +6,0 @@ "repository": {

@@ -21,2 +21,6 @@

```js
npm install redux-simple-router
```
## Isn't there already redux-router?

@@ -26,3 +30,3 @@

project which solves the same problem. However, it's far more complex.
Just looks look at this code: the whole thing is only 68 lines of JS.
Just look at this code: the whole thing is only 68 lines of JS.
redux-router is much bigger and more complex.

@@ -49,3 +53,3 @@

The idea of this libray is to use react-router's functionality exactly
The idea of this library is to use react-router's functionality exactly
like its documentation tells you to. You can access all of its APIs in

@@ -63,12 +67,13 @@ routing components. Additionally, you can use redux like you normally

```js
const { createStore } = require('redux');
const { createStore, combineReducers } = require('redux');
const { Provider } = require('react-redux');
const { Router, Route } = require('react-router');
const createBrowserHistory = require('history/lib/createBrowserHistory');
const { syncReduxAndRouter, routeReducer } = require('redux-simple-routing');
const { syncReduxAndRouter, routeReducer } = require('redux-simple-router');
const reducers = require('<project-path>/reducers');
const store = createStore(Object.assign({}, reducers, {
const reducer = combineReducers(Object.assign({}, reducers, {
routing: routeReducer
});
}));
const store = createStore(reducer);
const history = createBrowserHistory();

@@ -95,4 +100,4 @@

```
const { updatePath } = require ('redux-simple-routing');
```js
const { updatePath } = require ('redux-simple-router');

@@ -110,3 +115,3 @@ function MyComponent({ dispatch }) {

```js
const { UPDATE_PATH } = require('redux-simple-routing');
const { UPDATE_PATH } = require('redux-simple-router');

@@ -126,3 +131,3 @@ function update(state, action) {

Call this with a react-router and a redux store instance to install
hooks that always keep both of them in sync. When one changes, so with
hooks that always keep both of them in sync. When one changes, so will
the other.

@@ -129,0 +134,0 @@

@@ -32,5 +32,3 @@

function locationToString(location) {
return location.pathname +
(location.search ? ('?' + location.search) : '') +
(location.hash ? ('#' + location.hash) : '');
return location.pathname + location.search + location.hash;
}

@@ -56,3 +54,3 @@

const routing = store.getState().routing;
// Don't update the router is nothing has changed. The
// Don't update the router if nothing has changed. The
// `avoidRouterUpdate` flag can be set to avoid updating altogether,

@@ -63,3 +61,3 @@ // which is useful for things like loading snapshots or very special

!routing.noRouterUpdate) {
history.pushState(null, routeState.path);
history.pushState(null, routing.path);
}

@@ -66,0 +64,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc