Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Frontend Engineering at Wantedly

Frontend Engineering at Wantedly

2019年 Wantedly 新人研修の資料です。

フロントエンドというざっくりしたテーマについての講義です。Wantedly のフロントエンドで使われている技術を見つつ、これからの Wantedly でのフロントエンド開発をするために知っておいてほしい技術などをデモをしつつ話しました。

Yuki YAMADA

May 22, 2019
Tweet

More Decks by Yuki YAMADA

Other Decks in Programming

Transcript

  1. ©2019 Wantedly, Inc. ࣗݾ঺հ Yuki Yamada Frontend Engineer @ Infrastructure

    Squad ೥݄ʹ৽ଔೖࣾ ϑϩϯτΤϯυͷ։ൃج൫Λࢧ͑Δ͜ͱ͕࢓ࣄ (JU)VCZBNBEBZVLJ 5XJUUFSJLVVZBEBNBZ w 8BOUFEMZ$IBUͰ೥ؒ಺ఆऀΠϯλʔϯ w 8BOUFEMZ1FPQMFͰ೥ؒΞϓϦέʔγϣϯΤϯδχΞ w 8BOUFEMZ7JTJUͰ೥ऑΞϓϦέʔγϣϯΤϯδχΞ w ݱࡏ*OGSBTUSVDUVSF4RVBEͰϑϩϯτΤϯυͷج൫։ൃ
  2. ©2019 Wantedly, Inc. ͳͥଟछଟ༷ͳϥΠϒϥϦΛ࢖ͬͯΔ Real world es201x and future αʔϏεͰϑϩϯτΤϯυͷ։ൃΛ࢝͠Ίͨ࣌఺Ͱͷྲྀ

    ߦΓΛબ୒͍ͯ͠Δ͜ͱ͕ଟ͍ɻ࣌ྲྀʹ৐͔ͬͬͨํ͕ ྑ͍఺΋ଟ͍ͨΊ 8BOUFEMZ7JTJU͸೥͔ΒͳͷͰK2VFSZ #BDLCPOFɻͦͷޙ"OHVMBS+4Λܦͯ3FBDU 3FEVY 8BOUFEMZ1FPQMF͸೥͔ΒͳͷͰ3FBDU  3FEVYΛ࠷ॳ͔Β࠾༻ 8BOUFEMZ$IBU͸೥͔Β"OHVMBS+4 ࣾ಺αʔϏε͸ύοͱࢼͯ͠ग़͢Έ͍ͨͳ͜ͱ͕͍ͨ͠ ͷͰ؆୯ &BTZ ʹ࢖͑Δ7VF͕ଟ͍ https://speakerdeck.com/mizchi/real-world-es201x-and-future?slide=11
  3. ©2019 Wantedly, Inc.  ύοέʔδϚωʔδϟ  #VJMEपΓͷπʔϧ  -JOUFS'PSNBUUFS 

    6*ϥΠϒϥϦ  ςετ ϑϩϯτΤϯυΛ։ൃ͢Δͱ͖ʹ࢖͍ͬͯΔٕज़ ύοͱ͜ͷߨٛதʹ࿩ͤΔ΋ͷΛબΜͰ·͢
  4. ©2019 Wantedly, Inc. ϑϩϯτΤϯυΛ։ൃ͢Δͱ͖ʹ࢖͍ͬͯΔٕज़ 6*ϥΠϒϥϦ%&.0 export class Counter extends React.PureComponent

    { constructor(props) { super(props); this.state = { count: 0, timer: null }; } componentDidMount() { const timer = setInterval(() => { this.setState(state => ({ count: state.count + 1 })); }, 1000); this.setState({ timer }); } componentWillUnmount() { clearInterval(this.timer); } render() { return <p>{this.state.count}</p>; } } ӈͷΑ͏ͳ$MBTTߏจͰهड़͞Εͨඵ͓͖ʹΧ΢ϯ τΞοϓ͍ͯ͘͠ίϯϙʔωϯτΛ)PPLT"1*Λ ࢖ͬͯॻ͖௚͢ͱͨ͠ΒͲ͏͢Δʁ
  5. ©2019 Wantedly, Inc. ϑϩϯτΤϯυΛ։ൃ͢Δͱ͖ʹ࢖͍ͬͯΔٕज़ 6*ϥΠϒϥϦ%&.0 function Counter() { const [count,

    setCount] = React.useState(0); const savedCallback = React.useRef(); function callback() { setCount(count + 1); } React.useEffect(() => { savedCallback.current = callback; }); React.useEffect(() => { function tick() { savedCallback.current(); } let id = setInterval(tick, 1000); return () => clearInterval(id); }, []); return <p>{count}</p>; } ӈͷΑ͏ͳ$MBTTߏจͰهड़͞Εͨඵ͓͖ʹΧ΢ϯ τΞοϓ͍ͯ͘͠ίϯϙʔωϯτΛ)PPLT"1*Λ ࢖ͬͯॻ͖௚͢ͱͨ͠ΒͲ͏͢Δʁ VTF4UBUFVTF3FGVTF&GGFDUͷ૊Έ߹Θ͕ͤඞ ཁɻͪΐͬͱ೉͍͚͠Ͳɺڧྗͳ΋ͷͳͷͰษڧͯ͠ Έͯ΄͍͠ɻ
  6. ©2019 Wantedly, Inc. ϑϩϯτΤϯυΛ։ൃ͢Δͱ͖ʹ࢖͍ͬͯΔٕज़ ςετ%&.0 +FTUͱ%0."1*Λ࢖ͬͯϑϩϯτΤϯυͷڍಈΛςετ͢Δɻ XJOEPXͷFWFOUMJTUFOFSΛςετͷதͰൃՐͤ͞Δํ๏ͱ͔͜Μͳ; ͏ʹͰ͖Δɻ const handler

    = jest.fn(); window.addEventListener("focus", handler); const focusEvent = new Event("focus"); window.dispatchEvent(focusEvent); expect(handler).toHaveBeenCalledTimes(1);