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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@j154004/react-tree

v1.0.0-alpha.3

Published

React based tree component

Downloads

2

Readme

React Tree

In development!

React based tree view component. Developed to visualise items from a NoSQL database that can be related to one another in a nested fashion.

Features

✔️ Expand top-level items to reveal child items

✔️ Integrates with your existing Redux store to allow you to writing middleware for actions emitted by the component

✔️ Support for multiple reusable React-Redux components in an existing Redux application through separate state reduction

✔️ Custom state selectors to store component state in separate places in the Redux store

Demo

You can import your component into the storybook, a good place to showcase your component.

Run the storybook with npm run storybook and navigate to http://localhost:6006 in your browser.

Github Pages

Before commiting your changes to Github you can run npm run build-storybook to build the storybook so that it can be hosted on Github pages.

Usage

Import the component

Import the component/s into your project:

import Tree from '@j154004/react-tree';

Add the component to a parent component:

<Tree selectState={state => state.itemTypeTwo.component} namespace="one" />
  • selectState is a function to tell the component where it should store its state in your application store.

  • namespace is the namespace to use in action types. For the above example the action trigger would look something like: @@react-tree/two/INCREMENT_COUNTER. Defaults to default, but it's recommended you always use a key, especially if you use the same component multiple times in one view.

Include reducers

You can store the component state anywhere in your Redux store, just import the component reducer:

import { combineReducers } from 'redux';
import { componentReducer } from '@j154004/react-tree';

const rootReducer = combineReducers({
  itemTypeTwo: combineReducers({
    component: componentReducer('two')
  })
});

Import SASS styles

Import the styles into your project also (in an existing SASS file):

@import "~MODULE_NAME/src/styles";

Include SASS in Webpack build

Add another path to include in the rule for SCSS files:

{
  test: /\.scss$/,
  use: [{
    loader: 'style-loader'
  }, {
    loader: 'css-loader'
  }, {
    loader: 'sass-loader',
    options: {
      includePaths: [
        path.resolve(__dirname, 'src'),
        componentModulePath
      ]
    }
  }]
}