Show Menu
Cheatography

Operation Totenham Cheat Sheet (DRAFT) by

about operation totenham

This is a draft cheat sheet. It is a work in progress and is not finished yet.

React

React
Client­-Side SPA Javascript Library
JSX
not supported by naviga­tors, uses Babel.It Allows HTML to be asiggned to a Javascript (JSX) variable
Components
used to split one big chunk of UI Code into multiple small "­com­pon­ent­s". Components can be reused many times.

Compon­ents: Functional

`
const CompName = (props <= / this is a table of props /) => {
/ Partie Logique /
var name = "ahmed";
return(
    // Code JSX
    <h1> 2 Quid mr friend {name}</h1>
)}
`
 

ES6 Iterable Methods

map
array_­nam­e.map((value,index) => {
consol­e.l­og(­"­current value is:" + value
})
filter
array_­nam­e.f­ilter((value,index) => {
return value.age >= 18
})
find
array_­nam­e.f­ind((value,index) => {
return value.u­ser_id === 101
})
reduce
array_­nam­e.r­educe((accumu­lator,value,index) => {
return accumu­lator + value;
},0 <= / Valeur­_In­itiale /)

Import­/Export

if only 1 component
export default Component;
if many
export { Comp1, Comp2...}
imp: if only 1 comp
import comp from "./c­omp.js­"
imp: if many
import { comp1, comp2 }
from "./c­omp­s.j­s"
 

JSX: Syntax General

assigning
 var title = <h1­>open na noor</­h1>
with variables
 var title = <h1­>my name is { user.name }</­h1>
embdedded balise­s/comp.
 var header = <div>
<h1­>We­lcome {name}</h1>
<p>copyright</p>
</d­iv>
styling
 var btn = <button style={{"textColor:"red"}}>
click here
</button>