I can’t wait to re-render my life! #403

Discuss in words something you learned in class today or this week.

This week i learned about React Routers. React Routers is a function, that when called, returns its component its assigned to. An example is when a user is on their browser and they click on a “About” page, the user get routed to that specific page via its declared route. Really awesome and super simple.

What is render() in React? Explain its purpose.

— We should start by explaining that each React component must have a render() because it returns a single React element which is the representation of the native DOM component.

Is setState() async?

— Because setState is asynchronous, subsequent calls in the same update cycle will overwrite previous updates, and the previous changes will be lost.

What are controlled components?

— A controlled component is one where form data is stored in the component’s state and updated by an “onChangeHandler”. A single handler can handle all of the form’s input fields, regardless of the type (input, select, textarea, etc). In addition to the benefit of consolidating data, controlled components enable in-place feedback.

What is the event loop in JavaScript?

— Event loop. The event loop got its name because of how it’s usually implemented, which usually resembles: queue.waitForMessage() waits synchronously for a message to arrive if one is not already available and waiting to be handled. In JavaScript, this is implemented using a central mechanism which listens for events and calls a callback function associated with it, whenever such event is triggered. Simply put, this is the Event Loop.

Why does ReactJS use className over class attribute?

Class is a keyword in javascript and JSX is an extension of javascript. That’s the principal reason why React uses className instead of class . See Javascript Keywords + Reserved Words. The fact that a token is a keyword means that we cannot use it in some expressions, e.g.