All Projects → jamiebuilds → React Required If

jamiebuilds / React Required If

Licence: mit
React PropType to conditionally add `.isRequired` based on other props

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Required If

prop-types
Fluent prop validation for Vue
Stars: ✭ 97 (+34.72%)
Mutual labels:  validation, props
Webargs
A friendly library for parsing HTTP request arguments, with built-in support for popular web frameworks, including Flask, Django, Bottle, Tornado, Pyramid, webapp2, Falcon, and aiohttp.
Stars: ✭ 1,145 (+1490.28%)
Mutual labels:  validation
Codice Fiscale
A PHP library to calculate and check the italian tax code (codice fiscale).
Stars: ✭ 57 (-20.83%)
Mutual labels:  validation
Inspector
A tiny class validation library.
Stars: ✭ 64 (-11.11%)
Mutual labels:  validation
Rest Hapi
🚀 A RESTful API generator for Node.js
Stars: ✭ 1,102 (+1430.56%)
Mutual labels:  validation
Vee Validate
✅ Form Validation for Vue.js
Stars: ✭ 8,820 (+12150%)
Mutual labels:  validation
Io Ts Reporters
Error reporters for io-ts
Stars: ✭ 58 (-19.44%)
Mutual labels:  validation
Angular Validate
Painless form validation for AngularJS. Powered by the jQuery Validation Plugin.
Stars: ✭ 71 (-1.39%)
Mutual labels:  validation
Openapi Spring Webflux Validator
🌱 A friendly kotlin library to validate API endpoints using an OpenApi 3.0 and Swagger 2.0 specification
Stars: ✭ 67 (-6.94%)
Mutual labels:  validation
React Bps
🔱 Create breakpoints to your component props
Stars: ✭ 64 (-11.11%)
Mutual labels:  props
Slimvalidation
A validator for PHP with Respect/Validation
Stars: ✭ 62 (-13.89%)
Mutual labels:  validation
Govalid
Data validation library for golang. [MIGRATING TO NEW ADDRESS]
Stars: ✭ 59 (-18.06%)
Mutual labels:  validation
Cakephp
CakePHP: The Rapid Development Framework for PHP - Official Repository
Stars: ✭ 8,453 (+11640.28%)
Mutual labels:  validation
Postcss Nested Props
PostCSS plugin to unwrap nested properties.
Stars: ✭ 58 (-19.44%)
Mutual labels:  props
Node Installed Check
Checks that all dependencies in your package.json have supported versions installed and complies with your specified node engine version range
Stars: ✭ 67 (-6.94%)
Mutual labels:  validation
Lcformvalidation
Javascript based form validation library, third party library / framework agnostic.
Stars: ✭ 58 (-19.44%)
Mutual labels:  validation
Fhir.js
Node.JS library for serializing/deserializing FHIR resources between JS/JSON and XML using various node.js XML libraries
Stars: ✭ 61 (-15.28%)
Mutual labels:  validation
Bagit Java
Java library to support the BagIt specification.
Stars: ✭ 65 (-9.72%)
Mutual labels:  validation
Vue Coerce Props
Coerce props to whatever you want
Stars: ✭ 72 (+0%)
Mutual labels:  props
Unicorn
Unicorn - W3C's Unified Validator
Stars: ✭ 70 (-2.78%)
Mutual labels:  validation

react-required-if

React PropType to conditionally add .isRequired based on other props

Install

$ npm install --save react-required-if

Usage

import React, {PropTypes} from 'react';
import requiredIf from 'react-required-if';

export default class Component extends React.Component {
  static propTypes = {
    disabled: PropTypes.bool,
    onClick: requiredIf(PropTypes.func, props => !props.disabled)
  };

  render() {
    return <button onClick={this.props.onClick}>Click Me</button>
  }
}

Result:

import React from 'react';
import {render} from 'react-dom';
import Component from './Component';

render(
  <div>
    <Component onClick={() => {})/> // ok
    <Component disabled={true}/> // ok
    <Component/> // NOooooooo
  </div>,
  document.getElementById('root')
);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].