Git Product home page Git Product logo

react-proptype-conditional-require's People

Contributors

andrevenancio avatar beefancohen avatar sarbbottam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-proptype-conditional-require's Issues

Conditional Prop as boolean

What if the conditional prop is a boolean value with a default value set to false? Couldn't get this to work.

Missing index.js

Examples form the README are incorrect. This line to be exact:

import isRequiredIf from 'react-proptype-conditional-require';

There's no index.js file, so we can't import like this.

`isRequiredIf` fork of `prop-types`.

@evcohen You did a great job with this! It's too bad that prop-types is in maintenance mode now and won't merge this in.

The company I work for went ahead and created a fork that adds isRequiredIf functionality. It takes a function and gets passed the props, like:

id: PropTypes.number.isRequiredIf( props => !props.uid )

It doesn't take a boolean like yours does because we didn't require that.

Anyway, just wanted to say thanks for your efforts and if anybody is still stuck using prop-types and wants to use a natural syntax for conditional requirements, feel free to use it. It can be found here:

https://github.com/cntral/prop-types/tree/isRequiredIf

And you can easily use it in your package.json like so:

"prop-types": "github:cntral/prop-types#isRequiredIf"

๐Ÿป

SourceMap warnings

Thank you very much for this extremely helpful library. I wanted to alert you to a non-critical issue that I noticed after installing the library in my React project (React version 16.0.0) -

In Chrome (version 63.0.3239.84), I'm getting the following warning:

DevTools failed to parse SourceMap: http://localhost:5000/js/isRequiredIf.js.map

and a slightly different variation in Firefox (version 57.0.3):

Source map error: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Resource URL: http://localhost:5000/js/app.js
Source Map URL: isRequiredIf.js.map

No problems in Safari, though.

As far as I can tell, this is not affecting performance, but I thought you'd want to know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.