Skip to content

trabe/simple-guards-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

simple-guards utilities for react development

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •