I have summarized and compiled a list of React.JS best practices from various sources across the internet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Model { | |
| constructor() { | |
| this.userCollection = [ ] | |
| this.selectedUser = null | |
| this.listeners = { | |
| 'selectedUser': [ ], | |
| 'userCollection': [ ] | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object MergeSort { | |
| def msort[T](xs: List[T])(implicit ord: Ordering[T]): List[T] = { | |
| def merge(xs: List[T], ys: List[T]): List[T] = (xs, ys) match { | |
| case (Nil, ys) => ys | |
| case (xs, Nil) => xs | |
| case (x :: xs1, y :: ys1) => | |
| if (ord.lt(x, y)) x :: merge(xs1, ys) else y :: merge(xs, ys1) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;Trying to use a global variable to allow function arguments | |
| BR main | |
| usrInput: .BLOCK 2 ;global variable #2d | |
| showChar: NOP0 | |
| charo '\n',i | |
| deco usrInput,d | |
| RET0 |