npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-routecharts

v1.0.4

Published

Demo http://router-view.mvc-works.org/

Readme

##router-Echarts

##Provides access to the last location in react + react-router (v4.x, v5.x) applications. -❤️ Using hooks? If yes, useLastLocation. -💉 Using HOC? - If yes, withLastLocation. -Handle redirects. -Support TypeScript -Useful for handling internal routing. -Easily prevent leaving your app by users.

//  src/api/grade
export function gradedelete({ id }) {
  return request.post('/grade/delete', { id });
}

##Demo -Edit react-router-last-location

-Note: Last location != Previous browser history state -This library only returns the location that has been active before the recent location change in the current window lifetime.

-This means, it is not equal to the "location that happened before navigating to this history state", or in other words "location to which you'll be redirected upon clicking browser back button".

//  src/view/echarts
import {gradeselect} from '../api/grade'
import echarts from 'echarts'
componentDidMount(){
    gradeselect().then(res=>{
  var myChart = echarts.init(this.refs.main);
      const newdata = res.data.result.map(item=>item.score)
      const newdata1 = res.data.result.map(item=>item.username)
      var option = {}
    myChart.setOption(option);
    })
  }
  render() {
    return (
      <div ref='main' style={{ width: xx, height: xx }}></div>
    );
  }

##Basic usage ###Chaining method if you want to pass a raw RegExp you can, like: Router.when(/^/home$/, ...)

Note the ^ and $, they are automatically added when you pass a string, but in regex you have to define them explicitly.

//  /src/utils/index
export function getSession(key) {
    return window.sessionStorage.getItem(key);
}

export function setSession(key, val) {
    return window.sessionStorage.setItem(key, val);
}

##Keywords With the Es7 spec there will be included the function decorators that use a similar syntax to java's annotations @someDec(asdasd) but untill now you will have to stick to Router.$.

For more examples, see /examples folder.

//  /src/utils/request
import { getSession } from './index';

const request = axios.create({
    timeout: 5000,
});

request.interceptors.request.use(
    config => {
        config.headers.authorization = getSession('token')
        return config;
    },
    error => {
        return Promise.reject(error);
    }
);

request.interceptors.response.use(
    response => {
        return response;
    },
    error => {
        return Promise.reject(error);
    }
);
export default request;
// src/App/main

import { NavLink } from "react-router-dom";
import RouterView from '../router/RouterView';

<NavLink to="/"></NavLink>
<RouterView routes={this.props.routes}></RouterView>