BVB Source Codes

prettier Show proptype_missing.js Source code

Return Download prettier: download proptype_missing.js Source code - Download prettier Source code - Type:.js
  1. /* @flow */
  2.  
  3. /* If you create a react component with createClass() but don't specify the
  4.  * propTypes, what should the type of props be?
  5.  *
  6.  * It used to be an empty object, but we didn't enforce that correctly, so
  7.  * people could do whatever they wanted with this.props.
  8.  *
  9.  * As of 0.21.0 it started to be an error when people used this.props in a
  10.  * strict equality situation. It was weird that this was only sometimes
  11.  * enforced, so glevi changed this.props to be Object by default.
  12.  *
  13.  * We may change this back to the empty object at some point and fix the
  14.  * situations where it didn't used to error
  15.  */
  16. var React = require('react');
  17. var Foo = React.createClass({
  18.   getID(): string {
  19.     // So this would have been an error in 0.21.0 if we didn't make this.props
  20.     // Object
  21.     switch (this.props.name) {
  22.       case 'a': return 'Bob';
  23.       default: return 'Alice';
  24.     }
  25.   },
  26.  
  27.   render() {
  28.     // But this never errored
  29.     return <div id={this.props.name} />;
  30.   }
  31. });
  32.  
downloadproptype_missing.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top