simple-guards-react
v1.1.1
Published
simple-guards utilities for react development
Downloads
5
Readme
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);