Repository navigation
Glossary
Table of Contents
- command
- components
- node and npm
- objects and properties
- object property value shorthand
- object spread
- tag
- terminal
Coming soon
- state
- props
- synchronous, asynchronous
BTW, the linked JS Bin code examples work best in Chrome or Firefox, not so good in Safari.
A command is an instruction that is used to control a computer program/script/application. The command is typically typed into a terminal.
Components are the building blocks of React apps, they are classes that might have data inputs and are rendered to create UI elements.
Here's an example of a simple "functional" component, written in concise fat-arrow style.
const Name = () => <h1>Ben</h1>
Here's another example, this is a "class" or "stateful" component.
import React, { Component } from 'react'
class App extends Component {
render = () => {
return (
<div>Ben</div>
)
}
}
export default App
See the workshop on components for full examples and detailed description of the differences between functional and stateful components. TODO hasn't been written yet, watch this space.
In the early days, Javascript scripts could only run in browsers. The browser provided the environment in which the scripts could be "interpreted". There was no ability to run the scripts either on a server, or directly on a computer. This limited the use of Javascript programs to "front-end" or "client-side" apps in a browser.
Node.js is an environment that enables Javascript scripts to be run out of the browser, either on a server or directly on a computer as a standalone application. Node interprets the scripts using a system called "V8 Javascript Engine", the same engine used by Google Chrome.
Node also provides a system of using code libraries (aka modules or packages) which can be combined to build the functionality of an application. These packages can be tiny things that might do something as minor as checking to see if a list of data is sorted, through to tools which can help build apps, such as React.
Because there are so many packages out there, other tools are used to manage which are used per project, and the dependencies of those packages, all the way down. NPM is one of these package managers.
Node and npm used in the building stage of making React apps by providing access to the modules that provide interface functionality, data connectivity, etc, and providing development functionality including the server in which we preview our React app.
See the Javascript page for a basic introduction to Objects, and try this Codeburst article for more detailed coverage of objects and properties. From this article, "objects are just like objects in real life. They have properties, sometimes can do things and often extend another object."
This is a concise way to set an object's properties, that can be used when you have the property value in a variable named the same as the property key. Run this in JS Bin
const name = "ben"
const diet = "anything"
// regular way
let person = {"name":name, "diet":diet}
// shorthand way
person = {name, diet}
console.log(person)This is a concise way to clone an object, particularly handy when you want a copy of an object, but change one or more of its properties. Run this in JS Bin
const person = {
name: "ben",
location: "beach",
diet: "cabbage"
}
const newPerson = { ...person, diet: "bananas" }
console.log(person)
console.log(newPerson)A tag is a bit of HTML code that provides structure to content. Tags are (generally) written in matching pairs of opening and closing parts, and they can have extra attributes and values. Here's an example of a paragraph tag.
<p>some content goes between the tags</p>This paragraph tag has an attribute named class which has a value of important.
<p class="important">some content</p>When you use an application like Word, you are using a "graphical user interface (GUI)" to do stuff to your data via menus and buttons. Another way of doing stuff with your data is by running programs that don't have a GUI, via a terminal, also known as a command line or command prompt. For Mac, there's a command line program in your Applications folder, called Terminal. To get a command line program on Windows, type command or cmd into the search field in your taskbar. Then, click or tap on the Command Prompt result.
Note: When you start your terminal, it will display a $ or > sign at the start of the line. Hence, when you see something like $ blah blah blah in the workshop steps, you don’t need to type the $ sign, just type the words in the instruction that follow it.