React js cheatsheet for website development

support321704 91 views 6 slides Mar 01, 2024
Slide 1
Slide 1 of 6
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6

About This Presentation

Struggling to keep track of all the ReactJS concepts and syntax? Have a look on our #cheatsheet on #reactjs basic concepts .

๐Ÿ”น ES6 Features: Arrow Functions, Destructuring, Spread Operators
๐Ÿ”น React Basics: Components, Props, State, JSX Syntax
๐Ÿ”น Hooks: useState, useEffect, useContext
๐Ÿ”น C...


Slide Content

www.techjet.ai +91 80955 50193

Write cleaner codes in

React.js &

x Don't do this Vv Do this

>>>

www.techjet.ai +91 80955 50193

1. Arrow functions

x Don't do this

1 function App() {
return <Root />;
3}

I botnis

const App = ( ) =>{
2return <Root />
3}

>>>

www:techjet.ai +91 80955 50193 >>>

2. Less Brackets

x Don't do this

1 const App = (props) => {
return <Root {...props}/>
}

I pothis

const App = props => {
return <Root {...props}/>
}

www:techjet.ai +91 80955 50193 >>>

3. Automatic Return

x Don't do this

1 const App = (props) => {
2 return <Root {...props}/>
30

I dothis

const App = props => {
<Root {= .. Props) }/>
3}

www.techjet.ai +91 80955 50193 >>>

4. Destructure props

x Don't do this

1 const App = props => (
2 <div>
3 <h2>{ props.name)</h2>
4 <h3>{ props. title}</h3>
> </div>

}

7 Do this

1 const App = ( (name, title) ) =>{
2 <div>
3 <h2>(name)</h2>
4 <h3>(title)</h3>
5 </div>
}

www.techjet.ai +91 80955 50193

5. Pass all props

x Don't do this

1const App = ( props ) =>{
2<div { ... props}>

3 {props .name}

I </div>

5)

I dothis

โ€˜const App = ( {name , ... rest }) => {
2<div { ... rest ) > {name}</div>
3 }