Oh dear God, I have decided to try and learn me some React now. I am starting with this tutorial – http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html – which is itself a year and half old, so who knows if I’ll manage it. At any rate, it’s worth writing down some basic concepts.
packages.json
NPM/Yarn uses the packages.json
file to understand CLI commands. For example, the CLI command (henceforth, simply, “command”) npm run
expects to see a “packages"
key in the JSON file, like so:
"scripts": { "test": "mocha --compilers js:babel-core/register --recursive" },
Sublime Text
You might be using Sublime. At this point, I am too, though I am more of an Emacs kind of guy. I could use Emacs 24.4’s electric-pair-mode
for auto-parenthesis completion but I don’t know what package/mode can help with JSX files. In Sublime, you will need to download some packages to handle this – ReactJS
, at least, perhaps others. I think you also need to install an NPM package.
React
This of course can get very large, but I like noting down things that I learn “bottom-up” – when odd error messages show me non-intuitive architectural behavior.
- When generating lists of components in React, via an iterator like
map
, each element of the produced list must have an attribute named preciselykey
. (See the ReactJS documentation on Keys.)