1.0.1 • Published 5 years ago

@wee-busines/wee-error-pages v1.0.1

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
5 years ago

wee-error-pages

Error pages for all wee apps

Install

yarn install wee-error-pages --save yarn add wee-error-pages

Usage

import * as React from 'react'

import { ErrorPagesContext } from 'wee-error-pages';
import { ResourceNotFound } from 'wee-error-pages';
import { ServerError } from 'wee-error-pages';

class Example extends React.Component {
  render () {
    return (
      <ErrorPagesContext.Provider value={{ language: 'de' }}>
        <ServerError backUrl="#login"/>
        <ResourceNotFound backUrl="#" />
      </ErrorPagesContext.Provider>
    )
  }
}

Running in development mode

Run wee-error-pages

Go to project root directory and run

yarn start

Run Example project

In a new command line terminal go to example directory and run

yarn start

In your browser go to localhost:3000 and see the example project in action. You can make changes in the library and view changes in the browser in your example project.

Building and testing library using yarn link.

If you only want to test the wee-error-pages component in your project you can build the library by running

yarn build

And then link the library using

yarn link

In the project where you want to test the components run following command

yarn link "wee-error-pages"

Now run your project and you will be able to test the library without downloading it from npm repo. This method is particularly useful when you just want to test the components locally when they are not available in npm repo.