1.1.1 • Published 7 years ago

simple-guards-react v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Simple Guards React

Description

React higher order component to add simple guards to your components.

Install

npm instal simple-guards-react

Usage

import React from "react";
import { withGuards } from "simple-guards-react";

const MyComponent = ({ name }) => (
  <div>
    Hello, <span>{name}</span>!
  </div>
);

const enhance = withGuards(({ name }, guard) => {
  guard(name === undefined, "name should be defined");
});

export default enhance(MyComponent);