JavaScript (JS) Refresher for React
A quick refresher on the JS concepts needed to learn and understand React
General
- Scripting language — interpreted at runtime instead of compile time
- Interpreted — it is interpreted at runtime by the client browser instead of being passed through a compiler that converts the code to byte code
- Supports OOP (object-oriented programming)
- Object libraries — Document Object Model (DOM)
- React uses the ES6 (EcmaScript / published in 2015) version of JS
Incorporating JS in HTML
You can incorporate JS in HTML using the <script>
tag:
Input/Output
Write
To an element on a page:
- The item must already exist on the page
document.getElementById("result").innerHTML = "hello";
To a page:
document.write(“Hello”);
document.writeln(“Hello”);