Tech World Software School
Education • Science & Tech
Learn computer software development online with video courses. Programming and engineering lessons including frontend and fullstack coding.
Interested? Want to learn more about the community?

Learn more first
Introduction to React.js and JSX

A lesson for beginners that introduces the library React.js that is used to build user interfaces (UI). It's part of frontend development in the browser, although learning the way of writing React can also translate to other platforms such as mobile with React Native and virtual reality with React VR.

CodeSandbox is leveraged as the development environment, although other web-based alternatives are also available. You can also develop locally, generating the project with a tool like create-react-app.

Writing an HTML-like pattern within JavaScript is also introduced. JSX transpilation is briefly explained using the Babel website's Try it out feature.

The lesson goes on teaching how to change the view that is rendered by the React component. You learn to return multiple things from a component function using a Fragment.

Finally, you briefly see, using the browser Developer Tools (DevTools for short), how the React.js application is injected in a lone, empty div element whose id is root....

Interested? Want to learn more about the community?

Learn more first
What else you may like…
Posts
Explanation of How Messages are Loaded in React App

The lecture goes over an explanation of how chat room or board messages are retrieved for a React app.

It goes over the call to the fetch function that returns a Promise.

Then it goes over how the Promise returned by fetch gets fulfilled with a Response object.

The body of the response is extracted and turned into an array of objects in JavaScript.

A new array of strings is made after calling map on the array of message post objects.

Finally, the mutation function from React useState is called to signal React the state for messages has changed, triggering the rendering of the component anew.

#reactjs

Using fetch to Retrieve Message Data for React App

The lecture goes over the use of fetch to retrieve data for the messages in a React application.

The Fetch API can be used to make an HTTP request to a backend server such as an API that serves data in the JSON format.

With a GET request, the default behavior of fetch, data for messages in a chat room-like user interface are retrieved.

The call to fetch returns a Promise that fulfills with a Response object.

You can extract the body of the response and interpret its text content as JSON, thus creating a JavaScript object with the mapped information. This is also known as deserialization or unmarshalling.

The json method of the response object can be called to extract the body of the response and read it as JSON, thus creating a JavaScript data structure with the data. In the example, it creates an array of objects.

Note the return value of the call to json is another Promise that fulfills with the deserialized value, so another call to then is necessary. Having multiple then statements ...

React useEffect with setTimeout to Understand the Setting of Data

The lecture explores the callback passed to the useEffect hook in React.

It uses a setTimeout to demonstrate that initially the data is in its initial state, until it is changed by the corresponding mutate function.

Once mutated, the state change signals React to render the component anew, resolving DOM discrepancies, and manifesting the new data to the user.

In the example, an empty list of messages is populated after some brief period of time, a simulation of what's like to make a request to a backend server to retrieve data.

#reactjs

Available on mobile and TV devices
google store google store app store app store
google store google store app tv store app tv store amazon store amazon store roku store roku store
Powered by Locals