問327
下記のような減算する関数subtractと加算する関数addがあります。
function add (x, y){
return x + y;
}
function subtract(x, y){| //An error occurs //The form will be canceled. On Android/Chrome/56.0.2924.87 | |
| $("<form />", { action: "/hoge/fuga", method: "post" }) | |
| .append($("<input />", { type: "hidden", name: "xtoken", value: xtoken })) | |
| .append($("<input />", { type: "hidden", name: "state", value: "/hoge/" + hogeId })) | |
| .append($("<input />", { type: "hidden", name: "hoge", value: hoge })) | |
| .append($("<input />", { type: "hidden", name: "back", value: location.pathname })) | |
| .submit(); | |
| ///// | |
| //// add .appendTo(document.body), before .submit() |
| ////////no key////////keyを持たないで返しているコード/// | |
| const users = this.state.users.map(function (user){ | |
| return <User id={user.id} name={user.name} />; | |
| }); | |
| ////////add key//////keyを設定して返しているコード/// | |
| const users = this.state.users.map(function (user){ | |
| return <User id={user.id} key={user.id} name={user.name} />; | |
| }); |
| import React, { Component } from 'hogehogefolder/react';//error react. Required module not found | |
| const MailToBtn = ({mailAddress, addClass, children }: Props) => ( | |
| <a className='block w100 ' href={mailAddress}> | |
| <button className={`${addClass} appearanceNone outlineNone btnMain btnShadow1 size1 type1 btn100 pad0`} type='button'> | |
| {children} | |
| </button> | |
| </a> | |
| ) | |
| export default MailToBtn |
| [ignore] | |
| .*/node_modules/.* | |
| [include] | |
| ./resources/es6 | |
| [libs]//add flowtyed folder | |
| ./resources/decls | |
| [options] |
| declare module 'hogehogefolder/react' { | |
| declare module.exports: any; | |
| } |
| resources/es6/hogehoge/components/stateless/Button/MailToBtn.js:3 | |
| 3: import React, { Component } from 'tel_fortune_lib/react'; | |
| ^^^^^^^^^^^^^^^^^^^^^^^ hogehogefolder/react. Required module not found |
| ////error | |
| this._increment = this._increment.bind(this); | |
| ^^^^^^^^^^ property `_increment`. Covariant property `_increment` incompatible with contravariant use in | |
| 27: this._increment = this._increment.bind(this); | |
| ^^^^^^^^^^^^^^^ assignment of property `_increment` | |
| /////// code //////// | |
| constructor(props: Props){ | |
| super(props); | |
| this.state = { |
| constructor(props: Props){ | |
| super(props); | |
| this.state = { | |
| value : this.props.value | |
| } | |
| const self: any = this | |
| self._increment = this._increment.bind(this); | |
| self._decrement = this._decrement.bind(this); | |
| }; |
| /* @flow */ | |
| //https://github.com/facebook/flow/issues/1517 | |
| import React, {Component} from 'react'; | |
| type Props = { | |
| title: string, | |
| visited: boolean, | |
| value: number | |
| } |
問327
下記のような減算する関数subtractと加算する関数addがあります。
function add (x, y){
return x + y;
}
function subtract(x, y){