Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
DevCoach 178: React | Teknik React Menghidupkan...
Search
Nad
December 01, 2024
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DevCoach 178: React | Teknik React Menghidupkan UI dengan State
Nad
December 01, 2024
Transcript
27 slides
Nur Rizki Adi Curriculum Developer Teknik React Menghidupkan UI dengan
State React
Todayʼs Topics • Class, The Legacy Component • Event Handling
• React Hooks • Pengenalan React DevTools React
React
Menangani UI Kompleks dan Terisolasi Bersifat Reusable Mengapa Harus React
Component? React
createElement, The React Legacy React import React from 'react'; const
element = React.createElement( 'h1', { id: 'my-title', className: 'text-red', }, 'Biodata Perusahaan', );
Nggak ada Bedanya dengan DOM Manipulation “Biasaˮ
HTML in JS const heading = React.createElement('h1', null, 'React'); const
strong = React.createElement('strong', null, 'best tool'); const paragraph = React.createElement('p', null, ['The ', strong, ' for building UI']) const divContainer = React.createElement('div', { className: 'container' }, [heading, paragraph]); const divContainer = ( <div className="container"> <h1>React</h1> <p>The <strong>best tool</strong> for building UI</p> </div> ); HTML in JS Version
Quiz #1 DevCoach 178 React
Quiz #1 DevCoach 178 Apa nama lain dari HTML in
JS?
Dua API untuk React Component Functional Class React
“Talk is cheap, Show me The Codeˮ Linus Torvalds
Strategi React Tree TodoList App
Component State React
Quiz #2 DevCoach 178 React
Quiz #2 DevCoach 178 Apa yang terjadi jika tombol “Ubahˮ
diklik?
Component State klik! Interaksi pengguna akan memperbarui state State merupakan
data di dalam component yang bila nilainya berubah component akan me-render ulang. Nilai state akan berubah ketika ada interaksi dari pengguna.
Implementasi Component State class Counter extends React.Component { constructor(props) {
super(props); // Inisialisasi state this.state = { count: 0 }; } onIncrease() { this.setState((prevState) => { return { count: prevState.count + 1 } }); } render() { return ( <div> <h1>{this.state.count}</h1> <button onClick={() => this.onIncrease()}> Increase </button> </div> ); } }
Props Drilling
Strategi React Tree TodoList App
State component hanya tersedia di Class Component! React Jika Tanpa
React Hooks
React Hook?
legacy.reactjs.org/docs/hooks-intro.html
Quiz #3 DevCoach 178 React
Apa yang terjadi jika tombol “Tambahˮ diklik? Quiz #3 DevCoach
178 React
Terima kasih nurrizkiadip Nur Rizki Adi Prasetyo NAdiprasetyo
[email protected]
Nur
Rizki Adi Prasetyo React
Feedback! dicoding.id/devcoachfeedback React
None
More Decks by Nad
See All by Nad
DevCoach 180: Back-End | Deploy Aplikasi dengan Aman dan Cepat Menggunakan CI/CD
nadiaaa22
0
110
DevCoach 179: Flutter | Ciptakan Animasi Epik dengan Animation
nadiaaa22
0
130
Dicoding Sharing Session: Unlocking the Machine Learning Workflow
nadiaaa22
0
130
DevCoach 176: React | Cara Jitu React Membangun UI
nadiaaa22
0
180
DevCoach 175: React | Kenalan dengan React: UI Web Masa Kini
nadiaaa22
0
110
DevCoach 174: Flutter | Bentangkan Sayap Kreativitasmu dengan Flutter Desktop
nadiaaa22
0
78
DevCoach 173: iOS | Mendalami SwiftUI, UI Framework Masa Depan!
nadiaaa22
0
170
DevCoach 172: Flutter | Tingkatkan Pengalaman Pengguna dengan Lokalisasi dan Aksesibilitas
nadiaaa22
0
140
DevCoach 171: Machine Learning in Google Cloud | Vertex AI di Google Cloud
nadiaaa22
0
330
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
540
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
670
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
670
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
680
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Raft: Consensus for Rubyists
vanstee
143
7.9k
Rails Girls Zürich Keynote
gr2m
96
14k
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k
Building Adaptive Systems
keathley
44
3.3k