Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/charlesstover/with-router

A pub-sub alternative HOC to react-router's withRouter HOC.
https://github.com/charlesstover/with-router

npm npmjs react react-router reactjs travis travis-ci travisci

Last synced: about 1 month ago
JSON representation

A pub-sub alternative HOC to react-router's withRouter HOC.

Awesome Lists containing this project

README

        

# withRouter [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Do%20you%20wish%20that%20withRouter%20would%20rerender%20your%20component%20when%20your%20route%20changes?%20Now%20it%20can%20with%20the%20with-router%20NPM%20package!&url=https://github.com/CharlesStover/with-router&via=CharlesStover&hashtags=react,reactjs,javascript,webdev,webdeveloper,webdevelopment)

A pub-sub alternative HOC to `react-router`'s `withRouter` HOC. It functions exactly the same way, except the wrapped component will re-render when the route changes. This is beneficial if your view changes depending on the current path.

[![version](https://img.shields.io/npm/v/with-router.svg)](https://www.npmjs.com/package/with-router)
[![minified size](https://img.shields.io/bundlephobia/min/with-router.svg)](https://www.npmjs.com/package/with-router)
[![minzipped size](https://img.shields.io/bundlephobia/minzip/with-router.svg)](https://www.npmjs.com/package/with-router)
[![downloads](https://img.shields.io/npm/dt/with-router.svg)](https://www.npmjs.com/package/with-router)
[![build](https://api.travis-ci.com/CharlesStover/with-router.svg)](https://travis-ci.com/CharlesStover/with-router/)

## Install

* `npm install with-router --save` or
* `yarn add with-router`

## Use

Use it the same way you would use `react-router`'s built-in `withRouter` HOC!