Front in Sampa 2023
afonsopacifer.github.ioRecriando o React do Zeroem 10 minutos1afonsopacifer.github.io
View Slide
AfonsoPacifer@afonsopaciferafonsopacifer.github.ioDevRel & Front-End Specialist2
Como usar o React?Sem create react app ou vite!
index.jsimport React.from “react"import ReactDom.from “react-dom"Install$ npm install react$ npm install react-dom
const Element = React.createElement('h1',{ className: ‘sampa' },'Hello World');ComponentHelloWorld.js?
const Element = React.createElement(…}ReactDOM.render(Element,document.getElementById(‘app’));Hello Worldindex.jsindex.htmlRende
Por queusar?
Não toca no DOM
Duas funções
.component( )JSconst Element = component('h1',{ id: ‘sampa' },'Hello');OBJ{type: 'h1',props: { id: ‘samba' },children: [‘Hello']}
.render( )JSrender(OBJ,document.getElementById(‘app’)); Hello DOM APIHello
Exemplo
.map( )
Não toca no DOM?
OBJ{type: 'h1',props: {id: “app”},children: []}New OBJ{type: ‘h2',props: {id: “app”},children: []}JScomponent('h1',{ id: ‘sampa' },'Hello')JSrender(OBJ,document.getElementById(‘app’));Diff
Virtual DOM
Virtual DOMDOM
DeveloperExperience
const Element = (Hello, world!);const HelloWorld = () => ();HelloWorld.jsJSX
…24
frontin.jsfrontin.jsgithub.com/afonsopacifer/frontinjs$ npm install frontinjsFunctional and stateless component library
frontin.jsfrontin.jsgithub.com/afonsopacifer/frontinjs
27"Não se limite a ser apenas um(a)Dev React,seja um(a) Dev Front-End”- Afonso Pacifer
@afonsopaciferObrigadoFront in Sampaafonsopacifer.github.io28