In React's terminology, there are five core types that are important to distinguish:
React Elements
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
In React's terminology, there are five core types that are important to distinguish:
React Elements
Below are many examples of function hoisting behavior in JavaScript. Ones marked as works
successfuly print 'hi!' without errors.
To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js
(I may be using incorrect terms below, please forgive me)
import React, { Component } from 'react'; | |
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux'; | |
import { provide, connect } from 'react-redux'; | |
import thunk from 'redux-thunk'; | |
const AVAILABLE_SUBREDDITS = ['apple', 'pics']; | |
// ------------ | |
// reducers | |
// ------------ |
// give it a name so it reuses the same window | |
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no"); | |
// reload in case it's reusing the same window with the old content | |
win.location.reload(); | |
// wait a little bit for it to reload, then render | |
setTimeout(function() { | |
React.render( | |
<DebugPanel top right bottom left > |
/* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
/* CSS */ | |
{ | |
/* | |
// Place your snippets for HTML here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// ${1}, ${2} for tab stops, ${0} for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"Print to console": { | |
"prefix": "log", | |
"body": [ |
// Place your settings in this file to overwrite the default settings | |
{ | |
"breadcrumbs.enabled": true, | |
"editor.acceptSuggestionOnEnter": "on", | |
"editor.detectIndentation": false, | |
"editor.fontFamily": "'Source Code Pro', Menlo, Consolas, Courier, monospace", | |
"editor.fontSize": 11, | |
"editor.formatOnSave": true, | |
"editor.multiCursorModifier": "ctrlCmd", | |
"editor.quickSuggestions": { |
If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:
let
and const
statements. For the purposes of the React documentation, you can consider them equivalent to var
.class
keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this
in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav