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 🙏

© 2026 – Pkg Stats / Ryan Hefner

new-react-comp

v1.0.2

Published

Simple react component generation

Readme

new-react-comp

Simple tool for faster react component generation. Only works with functional components and hooks (there is an option for react-redux hooks).

Simple example:

new-react-comp ExampleComponent

Will create .js file in current working directory with folowing code:

import React from 'react';

const ExampleComponent = () => {
  return(
    <div>
    </div>
    )
};

export default ExampleComponent;

Installation:

npm install -g new-react-comp

Options:

Specific path

Path for a component generation can be specified. Command will also generate any missing directory. For example:

new-react-comp client/src/components/ExampleComponent

Generation inside directory

There is an option to generate .js file inside a new directory with the same name as the component. Example:

new-react-comp components/ExampleComponent -f

Stylesheet generation

.css or .scss files can be generated as well in the same directory as the .js file and with the same name. Stylesheet file would be automatically imported into component. Example:

new-react-comp components/ExampleComponent --scss
import React from 'react';
import './ExampleComponent.scss';

const ExampleComponent = () => {
  return(
    <div>
    </div>
    )
};

export default ExampleComponent;

Import hooks

React hooks:

new-react-comp components/ExampleComponent --effect --state

or

new-react-comp components/ExampleComponent -es
import React,  { useEffect, useState} from 'react';

const ExampleComponent = () => {
  const [state, setState] = useState('');

  return(
    <div>
    </div>
    )
  };

export default ExampleComponent;

React-redux hooks:

new-react-comp components/ExampleComponent --selector --dispatch

or

new-react-comp components/ExampleComponent -ld
import React from 'react';
import { useDispatch, useSelector} from 'react-redux';

const ExampleComponent = () => {
  const dispatch = useDispatch();

  const s = useSelector(state => state);

  return(
    <div>
    </div>
    )
  };

export default ExampleComponent;

All options:

| Short version | Long version | Description | |---------------|--------------|------------------------------------------------------------------------------------------------------| | -f | --folder | Specifies if component has to be contained inside the folder | | -s | --state | Imports useState hook from 'react' library | | -e | --effect | Imports useEffect hook from 'react' library | | -d | --dispatch | Imports useDispatch hook from 'react-redux' | | -l | --selector | Imports useSelector hook from 'react-redux' | | -p | --props | Specifies if component has to take props as an argument | | none | --css | Creates .css file with the same name as the component and imports it in | | none | --scss | Same as --css option, but will create .scss file. Only one of the stylesheet options can be used |