day 252 — code 365

Mon 22 Aug 2016

Terminal

Managed to successfully set up this alias in .zshrc

alias lint="./node_modules/.bin/eslint ./src ./test"

Previous attempts:

export lint="./node_modules/.bin/eslint ./src ./test"

Also put it in .bash_profile (doesn’t work, because my terminal runs in ZSH now)

Also forgot to open a new terminal, which meant my changes weren’t made active!

Oh, the adventures of learning basic terminal commands!

React

Learnt that we can’t call functions inside render calls.

This causes things similar to an endless loop, because when internal component state changes, render is called again:

Placing this inside JSX will throw an error:

{getText(this.state.view).secondary}
Cannot update during an existing state transition (such as within ‘render’ or another component’s constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved to ‘componentWillMount’.

Placing this inside a component’s props will throw the same error:

onClick={handleClickBtnMain}