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
Reactjs外でのDOM操作
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
chimame
August 18, 2016
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Reactjs外でのDOM操作
shinosakarb #24
chimame
August 18, 2016
More Decks by chimame
See All by chimame
Cloudflare is Agents
chimame
0
190
知って得する@cloudflare_vite-pluginのあれこれ
chimame
2
660
Boost Your Web Performance with Hyperdrive
chimame
1
570
RemixでVersion skewに立ち向かう
chimame
2
1.3k
私がエッジを使う理由
chimame
10
4.2k
GraphQL Server on Edge after that
chimame
1
1.8k
Accelerating App Dev with Cloudflare Workers
chimame
1
510
GraphQL Server on Edge
chimame
12
6.8k
エッジで輝くフロントエンド
chimame
11
7k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Between Models and Reality
mayunak
4
450
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
A Modern Web Designer's Workflow
chriscoyier
699
190k
Believing is Seeing
oripsolob
1
210
My Coaching Mixtape
mlcsv
0
310
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
270
Writing Fast Ruby
sferik
630
63k
Transcript
ېسɿReactjs֎ͰͷDOMૢ࡞ 2016.08.20 @rito https://github.com/chimame/20160820_lt
ࣗݾհ <Self name="rito" profile="Web engineer" reactjs="1.month" />
–Lezard VALETHɹϨβʔυɾϰΝϨε “ېسΛ൜ͯ͠չ͍ແ͍ɻ ͦΕ͚ͩͷ͍͕͔֬ʹ༗Δɻ য͕ΕΔ͜ͷڳͷࢥ͍ΛڰؾͱݺͿͳΒɺԺ ͔ͳ࿀͔͠Β͵ݾͷෆጫΛ୰͕͍͍͘ʂ” ήʔϜɿϰΝϧΩϦʔϓϩϑΝΠϧΑΓ (c)2013 SQUARE ENIX
CO., LTD.All Rights Reserved.
ྫ͑͜ΜͳཁΛ࣮͢Δ <marquee height=45 direction=up> ېسΛ൜ͯ͠չ͍ແ͍ɻ<br /> ͦΕ͚ͩͷ͍͕͔֬ʹ༗Δɻ<br /> য͕ΕΔ͜ͷڳͷࢥ͍ΛڰؾͱݺͿͳΒɺԺ͔ͳ ࿀͔͠Β͵ݾͷෆጫΛ୰͕͍͍͘ʂ
</marquee> จࣈΛ্ԼʹࣗಈεΫϩʔϧ͍ͤͨ͞ɻແݶεΫϩʔϧͰද͍ࣔͤͨ͞ɻ ͨͩ͠ɺHTML5Ͱഇࢭ͕༧ఆ͞Ε͍ͯ·͢ʂ༻͠ͳ͍Α͏ʹʂʂ marqueeλάʹཔΕͳ͍ͰͷjQueryͷ ϓϥάΠϯͰ͍͍ײ͡ͷΞχϝʔγϣϯͳ ͍͔ͳʁɹ㱺
͍͍ײ͡ͷϓϥάΠϯΛൃݟʂ ېسͱΒͣʹ…
࣮ import React, { Component } from 'react' import $
from 'jquery' import 'jquery.marquee' export default class message extends Component { componentDidUpdate() { $("div.message-body").marquee({direction: 'up'}) $("div.message-body").marquee('resume') } render() { const { message } = this.props return ( <div className=“message-body"> <p style={{whiteSpace: ‘pre’}}> {message} </p> </div>
ॳظදࣔͰ͖ͨɻ ͨͩɺ࠶औಘͯ͠දࣔϝοηʔδ͕มΘͬͯը໘ ͕มΘΒͳ͍ɻ αʔόʢAPIʣ͔Βͷऔಘ͜Μͳײ͡
࣮ࡍʹग़ྗ͞Ε͍ͯΔHTMLιʔεΛݟͯΈΔͱ… ͋ΕʁͳΜ͔Βͳ͍λά͕͍͍ͯΔɻ jQuery.Marquee͕ΞχϝʔγϣϯͷͨΊʹՃ͍ͯ͠Δɻ
ݪҼ ReactjsͰग़ྗͨ࣌͠ͷDOMΛ͍֮͑ͯΔɻ ࠶ඳը͢Δ࣌ग़ྗͨ͠DOM͔Βมߋ෦͚ͩΛআͯ͠৽ͨʹDOMΛग़ྗ͢Δɻ ࠓճͷྫͰɺjQuery.Marquee͕DOMΛॻ͖͑ͯ͠·ͬͨͨΊʹൃੜɻ https://facebook.github.io/react/tips/use-react-with-other-libraries.html ରॲ Ҋ̍ɿ jQuery.Marqueeͷ༻ΛΊɺ࣮Λม͑Δɻ ɹˠjQueryΞχϝʔγϣϯͳΒOK Ҋ̎ɿ
Reactjsͷ࠶ඳըΛࢭΊΔɻ ɹˠ͜ͷҊ࠶ඳը͕ߦ͑ͳ͘ͳΔɻ ཁ݅ͱͷ݉Ͷ߹͍͕ͩɺ”ͦͷ̎”Ͱ͍͍ͳΒ…
–FreyaɹϑϨΠ “ͤΊͯࢲͷखͰ͋ͳͨΛΓʹ͔ͭͤͯ͋͛ΔΘɻ” ήʔϜɿϰΝϧΩϦʔϓϩϑΝΠϧΑΓ (c)2013 SQUARE ENIX CO., LTD.All Rights Reserved.
࣮ʢ࠶ඳըఀࢭ൛ʣ import React, { Component } from 'react' import $
from 'jquery' import 'jquery.marquee' export default class message extends Component { componentDidUpdate() { $("div.message-body").marquee({direction: 'up'}) $("div.message-body").marquee('resume') } shouldComponentUpdate() { return false } render() { const { message } = this.props return ( <div className="message-body"> ࠶ඳըΛͤ͞ͳ͍Α͏ʹ͢Δ͜ͱ͕Մೳ
·ͱΊ • Reactjs֎ͰDOMΛ৮Δͱ࠶ඳըͰ͖ͳ͍ͱߟ͑Δɻ • Reactjs֎ͰDOMΛ৮Δ߹ ɺ”componentDidMount"ͷඳըޙͰ৮Δ͜ͱɻ • ࠶ඳըΛʮߦ͏ʯ͔ʮߦΘͳ͍͔ʯఆ͢Δ” shouldComponentUpdate”ͱ͍͏Lifecycle͕ଘࡏ͢ Δɻ
ͳͷͰͷཁૉҎ֎Ͱ͠ͳ͍Α͏ʹʂʂ
͓·͚ Marquee͜Μͳײ͡Ͱ࡞ͬͯΈ·ͨ͠ɻʢڵຯ͋Εʣ https://gist.github.com/chimame/ 99acd1836992675169f2c705d1fe3209