Blog Post 403

Corey Tyler
2 min readOct 26, 2020
  1. Discuss in words something you learned in class today or this week.

This week in class we covered how to make forms in React and how to make fetch requests in React. We learned how to render and manipulate the data that gets returned with out fetch requests as well as how to handle onClicks and onChanges in separate components as well as manipulating the state of the application to hold the new values entered in the input slots.

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

Render() is a method in React that is meant to hold whatever you wanted to display to the client side. You can place React components right in the render method. Though simple JavaScript can be plugged into the render method to bring in components (such as a OnChange and OnClick) but on complex Javascript can not be used in the render method. The render method always has to return something, and whatever it returns has to be wrapped in a single parent HTML tag (usually a div tag).

3. Is setState() async?

setState() actions are asynchronous. According to the documentation of setState() , setState() does not immediately mutate this. state but creates a pending state transition.

4. What are controlled components?

A Controlled Component is one that takes its current value through props and notifies changes through callbacks like onChange . A parent component “controls” it by handling the callback and managing its own state and passing the new values as props to the controlled component.

5. Which (if there is) node library method could you use to solve the algorithm problem you solved last night in your pre-homework?

No algorithms or special libraries were used besides the standard node package manager to initiate and run the app.

6. Which (if there is) node library method could you use to solve the algorithm problem you solved in class tonight?

I don’t believe there was an algorithm I could have solved in class tonight. All we worked on was our music app for our checkpoint and we worked together on the current nights homework but there were no algorithm’s needed.

7. What is the event loop in JavaScript?

The Event Loop has one simple job — to monitor the Call Stack and the Callback Queue. If the Call Stack is empty, it will take the first event from the queue and will push it to the Call Stack, which effectively runs it. Such an iteration is called a tick in the Event Loop. Each event is just a function callback.

8. Why does ReactJS use className over class attribute?

React uses className and not the class attribute because in React the class attribute is how you create a class-based component. Therefore you must use className to specify the class name in order to manipulate the node with CSS or an outside component.

--

--