Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebComponent
Search
milkmidi
August 12, 2023
Programming
1
3.1k
WebComponent
2023 Webconf - WebComponent
milkmidi
August 12, 2023
Tweet
Share
More Decks by milkmidi
See All by milkmidi
202403-WebComponent
milkmidi
0
170
前端好朋友-tailwindcss
milkmidi
0
8.3k
202110-federation
milkmidi
0
150
Vue3一次就上手
milkmidi
0
6.3k
202007-React對戰雷台
milkmidi
0
180
Other Decks in Programming
See All in Programming
Development of an App for Intuitive AI Learning - Blockly Summit 2025
teba_eleven
0
120
今ならAmazon ECSのサービス間通信をどう選ぶか / Selection of ECS Interservice Communication 2025
tkikuc
11
2.7k
Using AI Tools Around Software Development
inouehi
0
1.2k
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
Prism.parseで 300本以上あるエンドポイントに 接続できる権限の一覧表を作ってみた
hatsu38
1
110
実践ArchUnit ~実例による検証パターンの紹介~
ogiwarat
2
280
すべてのコンテキストを、 ユーザー価値に変える
applism118
1
290
GoのGenericsによるslice操作との付き合い方
syumai
2
670
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
120
GraphRAGの仕組みまるわかり
tosuri13
7
450
Javaに鉄道指向プログラミング (Railway Oriented Pro gramming) のエッセンスを取り入れる/Bringing the Essence of Railway-Oriented Programming to Java
cocet33000
2
580
C++20 射影変換
faithandbrave
0
500
Featured
See All Featured
Embracing the Ebb and Flow
colly
86
4.7k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Building an army of robots
kneath
306
45k
GitHub's CSS Performance
jonrohan
1031
460k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
KATA
mclloyd
29
14k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.9k
Site-Speed That Sticks
csswizardry
10
650
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
Transcript
如何⽤ React 發⼤財 WebComponent 202308 - milkmidi
milkmidi (奶綠茶) PositiveGrid Staff Frontend Engineer
[email protected]
https: / / www.facebook.com/milkmidifans
Ten years ago!
jQuery Flash Action Script Silverlight RWD 是三⼩! bootstrap
10 年前奶綠出過兩本書 已絕版 每年都要拿 Flash 出來鞭⼀下
Web Development Trends in 2023 React / Vue / Angular
Flash Action graphQL TailwindCSS webassembly Webpack / Vite No jQuery Test
我也想靠 Flash 吃⼀輩⼦呀 結果 Jobs ⼀句話我就失業了
Why WebComponent?
PM 要請你修改 sign-in 功能,這時你會 ?
jQuery 再戰⼗年
None
None
None
WebComponent 是你的救贖
None
None
1 好找,好改 2 限縮 JS scope 3 準時下班
PM說: 現在要修改登出鈕按的⾏為。 不急,⼗分鐘後再給我就好
這時你要回答?
None
要使⽤前有個 But ⼈⽣就是這個 But
None
How to use?
None
None
connectedCallback() Invoked when the custom element is first connected to
the document's DOM. disconnectedCallback() Invoked when the custom element is disconnected from the document's DOM. attributeChangedCallback() Invoked when one of the custom element's attributes is added, removed, or changed. Life cycle callbacks
attributeChangedCallback
Shadow DOM 與世隔絕的安全⼩屋 這我家的貓,很可愛吧
None
外層和 Shadow DOM 的 style 不會互相影響 但,也是缺點 透過 attachShadow( {
mode } ); 可以讓外層的 JS 是否可以呼叫 shadowDOM 裡的元素 mode: open:element.shadowRoot // ShadowRoot obj mode: closed: element.shadowRoot // null
Shadow DOM + slot 這我家的貓,很可愛吧
None
下段語法寫錯,正確為 document.createElement(‘my-component’)
Web Component 就是這麼簡單
加薪技能樹
WebComponent + petite-vue
None
都是尤⼤⼤開發的 Only ~ 6kb DOM-based, mutates in place(not virtual DOM)
petite-vue
None
None
https://www.positivegrid.com/products/spark 實際應⽤
None
WebComponent 限縮 scope petite-vue 處理阿雜的 DOM 事件 本來專案就走 SSR 的情況下,很適合導入
工具沒有好或壞 用的好帶你上天堂 還是我家的貓,還是很可愛
學習不需要為公司、長官或同事, 不需要為別人,只為你自己。 五倍紅寶石-高見龍
⼯商服務 Positivegrid 徵 Senior Android Engineer Senior Backend Engineer Machine
Learning Engineer C++ Developer
QA
https://www.facebook.com/cmoneyengineer/photos https://www.facebook.com/groups/2616981278627207 圖片出處