https://codepen.io/gaearon/pen/gWWZgR?editors=0010
- Display the location for each move in the format (col, row) in the move history list.
function getColRow(i) {
function col(i) {
const one = new Set([0, 3, 6])
https://codepen.io/gaearon/pen/gWWZgR?editors=0010
function getColRow(i) {
function col(i) {
const one = new Set([0, 3, 6])
/* | |
1. break the UI into a component hierarchy | |
2. build a static version in React | |
3. identify the minimal (but complete) representation of UI state | |
4. Identify where your state should live | |
5. Add inverse data flow | |
3. identify the minimal (but complete) representation of UI state | |
Chrome 71, Mac
/* what do these log ? */ | |
var a; | |
console.log(a); | |
var n = null; | |
console.log(n + 2) | |
console.log('The value of c is ' + c); |
Break the UI into a component hierarchy
Build a static version
render()
methods and use props
. The component at the top of your hierarchy
will take your data model as a propYou can build top-down or bottom-up. That is, you can either start with building the components higher up in
This form has the default HTML form behavior of browsing to a new page when the user submits the form. It's convenient to have a JavaScript function that handles the submission of the form and has access to the data that the user entered in the form. In React, you do this w/ 'Controlled Components'
In HTML, form elements such as , <textarea>, and typically maintain their own state and update it based on user input. In React, mutable state is typically kept in the state property of components and only updated with 'setState()'. We can combine the two by making the React state the single 'source of truth'. Then the React component that renders the form also controls what happens on subsequent user input. An input form element whose value is controlled by React in this way is called a 'controlled component'
prefix: NodeAddressT
parameter to nodesIterator
-> tests pass (nothing passed in/ parameter not used)tests fail; NodeAddress isn't defined
imported 'NodeAddress'
* - direction: one of Direction.IN, direction.OUT, or Direction.ANY.
* - Direction.IN finds neigbhors where root is the destination of the
* edge.
* - Direction.OUT finds neigbhors where root is the source of the edge.
* - Direction.ANY finds neigbhors where root is the source or destination
* of the edge.
*