Skip to content

Instantly share code, notes, and snippets.

View pi0's full-sized avatar
🎯

Pooya Parsa pi0

🎯
View GitHub Profile
@pi0
pi0 / ResumeCreator.js
Last active June 28, 2018 08:23 — forked from farzadso/No mutations at all
This is what I call clean coding
import assert from 'assert';
updateStepFourProps(type, operation, id) {
assert(Array.isArray(this.state[type]), `Cannot do operation on type '${type}'`)
switch (operation) {
case 'add':
this.setState({
[type]: this.state[type].concat(id)
})