BVB Source Codes

prettier Show create_class_initial_state_sealed.js Source code

Return Download prettier: download create_class_initial_state_sealed.js Source code - Download prettier Source code - Type:.js
  1. import React from "react";
  2.  
  3. // initial state = None
  4. React.createClass({
  5.   f() {
  6.     this.setState({ q: 0 });
  7.   },
  8.   g() {
  9.     (this.state.q: empty); // number ~> empty
  10.   }
  11. });
  12.  
  13. // initial state = Some (exact & sealed) [lit]
  14. React.createClass({
  15.   getInitialState() {
  16.     return { p: 0 };
  17.   },
  18.   f() {
  19.     this.setState({ q: 0 });
  20.   },
  21.   g() {
  22.     (this.state.q: empty); // number ~> empty
  23.   }
  24. });
  25.  
  26. // initial state = Some (exact & sealed) [annot]
  27. React.createClass({
  28.   getInitialState(): {| p: number |} {
  29.     return { p: 0 };
  30.   },
  31.   f() {
  32.     this.setState({ q: 0 });
  33.   },
  34.   g() {
  35.     (this.state.q: empty); // number ~> empty
  36.   }
  37. });
  38.  
  39. // initial state = Some (inexact & sealed) [annot]
  40. React.createClass({
  41.   getInitialState(): { p: number } {
  42.     return { p: 0 };
  43.   },
  44.   f() {
  45.     this.setState({ q: 0 }); // property `q` not found
  46.   },
  47.   g() {
  48.     (this.state.q: empty); // property `q` not found
  49.   }
  50. });
  51.  
  52. // mixins = (exact & sealed) + (exact & sealed)
  53. React.createClass({
  54.   mixins: [{
  55.     getInitialState() {
  56.       return { foo: 0 };
  57.     },
  58.   }],
  59.   getInitialState() {
  60.     return { bar: 0 };
  61.   },
  62.   f() {
  63.     this.setState({ baz: 0 });
  64.   },
  65.   g() {
  66.     (this.state.baz: empty); // number ~> empty
  67.   }
  68. });
  69.  
  70. // mixins = (exact & sealed) + (inexact & sealed)
  71. React.createClass({
  72.   mixins: [{
  73.     getInitialState(): { foo: number } {
  74.       return { foo: 0 };
  75.     },
  76.   }],
  77.   getInitialState() {
  78.     return { bar: 0 };
  79.   },
  80.   f() {
  81.     this.setState({ baz: 0 }); // property `baz`  not found
  82.   },
  83.   g() {
  84.     (this.state.baz: empty); // property `baz` not found
  85.   }
  86. });
  87.  
downloadcreate_class_initial_state_sealed.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