@source4society/react-scepter-alert-decorator

1.0.1 • Public • Published

react-scepter-alert-decorator

Decorate a container so it can hook into the react-authapp-container messaging system

scepter-logo

redux-logo

react-boilerplate

airbnb-codestyle

Build Status

codecov

Installation

npm install @source4society/react-scepter-alert-decorator

or

yarn add @source4society/react-scepter-alert-decorator

Usage

This decorator hooks a container into the react-scepter-authapp-container message state, and adds a prop function called renderMessage that will display the message using the react-alert-component. You will need to pass in a function to handle the message label translations in order to get the decorator. It looks something like this:

const Component = (props) => <div>{props.renderMessage(props.message)}</div>; // A dummy component to wrap. This component just displays the message, but it could be anything.
import alertDecorator from '@source4society/react-scepter-alert-decorator';
const labels = (message) => message; // create your labels function. This example does not perform any translation of the messages
const withAlert = alertDecorator(labels);
export default compose(withAlert)(Component);

Readme

Keywords

none

Package Sidebar

Install

npm i @source4society/react-scepter-alert-decorator

Weekly Downloads

1

Version

1.0.1

License

AGPL-3.0

Unpacked Size

96.3 kB

Total Files

27

Last publish

Collaborators

  • danfredriksen