reading-notes

Reading notes about code for my future reference.

View the Project on GitHub

Reading 26

React hello world

What are the building blocks of a React app?

The building blocks of a React app are JSX.

What is the difference between an element and a React component?

A react component can hold and transfer props and have elements and functions contained within them. While an element is contained within an element and can also within a component.

What are some advantages of React’s component based architecture?

It makes it easy and compact for modularization and reusing functions for various parts of an app.

Introducing JSX

What is JSX and why do we use it?

JSX is a react specific feature. They allow the user to utilize React elements. They are a technically syntax extensions to javascript. Describe the process of embedding JavaScript expressions in JSX.

Declare a variable name, give a function or definition. Then in app or whereever it lives embed it and wrap it with brackets.

Is it safe to embed user input in JSX? Explain.

No it is not, because this opens the vulnearability to a cross scripting attack.

Rendering elements

Explain what a React Component is to a non-technical friend.

A react component is like a stamp. It has a defined characteristics that you set. These can be then used in many places and have the same definition and it can pass the message around on many pieces of paper aka parent components.

Describe mutability and React Components, specifically, how is the UI updated?

The UI is updated using state, state can be set using class components or if using functional components it uses hooks.

If changes are made to the UI, what does React update?

React will update the state.