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

react-custom-errors

v1.0.9

Published

An Error Custom Display Component for React

Downloads

28

Readme

React Custom Errors

An Error Custom Display Component for React

Install

npm install react-custom-errors || yarn add react-custom-errors

How to use

import React from 'react';
import ReactDOM from 'react-dom';
import ErrorPage from 'react-custom-errors';



const App = () => (
  <div>
    <ErrorPage />
  </div>
);

export default App;

ErrorPage without props

<div>
    <ErrorPage />
</div>

In this scenerio, the component would have no error code rendered, but a very beautiful page with an svg image, signlaing an problem happened

ErrorPage with props

<div>
    <ErrorPage code="404"/>
</div>

In this scenerio, the component would display to the user, a beautiful error page, with the status code supplied and meaning of the status code.

If the developer wishes to customize the error message shown then, they can add an additonal prop to the ErrorPage component like this:

<div>
    <ErrorPage code={404} customMessage="Gotcha... Page not found" link="/home" backgroundColor="brown" />
</div>

Parameters

| params | value | default value | description | |:------------:|:--------:|:------------------------------------:|:----------------:| | code | number | REQUIRED | The error code you want displayed on the ErrorPage component | | customMessage| string | NOT REQUIRED | If provided, the package would make use of it, if not the package would generate the error message itself accurately | | link | string | NOT REQUIRED | Provide this prop, which would be a route to where the user would be directed to, if they were to click on the button to go back to dashboard | | backgroundColor |string | NOT REQUIRED | If you would love to add more feel and more color customization, to meet your sites theme, you can specify a background color as prop |

More details can be found in the official site:

  • Site is still worked on

Dev Server

npm run start || yarn start

Default dev server runs at localost:3000 in browser.

Run Tests

npm run test:watch

Production Bundle

npm run build || yarn build

Follow me on Twitter: @devopsjay