View on GitHub

Wiki

A Wiki which shows the results of different courses

Download this project as a .zip file Download this project as a tar.gz file

Navigation

AWS

Microservices

Docker

Kubernetes

ServiceNow

JavaScript

React

Ethical Hacking

Introduction to React

Generating a Project and folder Structure

You can generate a new react project by simply calling

npx create-react-app <app-name>

The newly generated React projcet gets generated with this structure:

Structure

About React Component

A React component is a plane Javascript function which returns some JSX.

A React Component has to jobs:

ReactComponent

About JSX

JSXElement

JSX handling

JSXInspector1

JSXInspector2

Rendering React

ReactRender

React and ReactDOM Libraries

ReactLibraries

JSX and HTML Differences

InlineStyle

Inline styling

First curly brace indicates that we want to reference a javascript variable the second curly brace is meant to indicate a javascript object. Anytime you want to add any styling that has some dash you remove that dash and capitalize the next character.

InlineStyle

Adding class to an Element

Instead of

<label class="label" for="name">

you would simply use

<label className="label" for="name">

To avoid collision with the JS-Keywoard of class but this will probably be removed in the future so you could then use class instead of className.

JS variables in JSX

In JSX it is possible to reference JS variables like buttonName in this example:

const App = () =>{
    const buttonName='submit';
    return (
        <div>
            <label className="label" for="name">
                Enter name:
            </label>
            <input id="name" type="text"/>
            <button style=>
                {buttonName}
            </button>
        </div>
    );
}

UseState

UseState