From a few tweetstorms by https://www.twitter.com/a_robson...
https://twitter.com/A_Robson/status/959838117619556352 https://twitter.com/A_Robson/status/960195581846147072
import * as React from "react"; | |
import formatPrice from "../utils/formatPrice"; | |
export interface IPriceProps { | |
num: number; | |
symbol: "$" | "€" | "£"; | |
} | |
const Price: React.SFC<IPriceProps> = ({ | |
num, |
// @ts-check | |
/** | |
* Format a price | |
* @param num {number} The price | |
* @param symbol {string} The currency symbol | |
*/ | |
const formatPrice = (num, symbol = "$") => | |
`${symbol}${num.toFixed(2)}`; | |
formatPrice("1234"); |
const formatPrice = (num: number, symbol = "$": string) => | |
`${symbol}${num.toFixed(2)}`; formatPrice("1234"); | |
// num.toFixed is not a function |
const formatPrice = (num, symbol = "$") => | |
`${symbol}${num.toFixed(2)}`; formatPrice("1234"); |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Run tests", | |
"program": "${workspaceRoot}/node_modules/.bin/jest" | |
}, | |
{ |
Name of thing | Sorta like... | Mounted? | Can you even setState? | What would you say... ya do here? |
---|---|---|---|---|
constructor | initialize() | nope | nope | init stuff NO side effects |
componentWillMount | beforeDomReady() | nope | yeah but don't | Only needed in createClass now use constructor for most things |
render | render | nope | please no | render stuff and don't set any state please |
componentDidMount | domReady() | yup | yup | DOM is a go init jQuery plugins dispatch stuff |
componentWillReceiveProps | onChange() | yup | yup |
Install each of the following tools to help along the way.
Pick a terminal wrapper, either is fine...
Install XCode
const toggleAssigned = (function () { | |
let showing = false; | |
return function (username) { | |
const $cards = $$(".issue-card"); | |
Array.from($cards).forEach((el) => { | |
if (!showing) { | |
if (!el.querySelectorAll("img[alt='@" + username + "']").length) { | |
el.style = "display:none"; |