React Complete Guide ⚛️

Components + Logic + Code

1. Introduction

React is a JavaScript library for building UI using components.

const element = <h1>Hello React</h1>;

2. Components

function App(){
  return <h1>Hello World</h1>;
}

3. JSX

const name = "Sasank";
const el = <h1>Hello {name}</h1>;

4. Props

function User(props){
  return <h1>{props.name}</h1>;
}

5. useState

const [count,setCount] = React.useState(0);

6. Events

<button onClick={() => alert("Clicked")}>
Click
</button>

7. Lists

const arr = [1,2,3];

arr.map(x => <p>{x}</p>)

8. Forms

<input onChange={(e)=>console.log(e.target.value)} />