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

Mint: Language Level Support for SPAs

Mint: Language Level Support for SPAs

Agata Naomichi

August 02, 2018
Tweet

More Decks by Agata Naomichi

Other Decks in Programming

Transcript

  1. ©2018 Wantedly, Inc. agatan Software engineer at Wantedly, Inc. Server

    side + Machine learning Github Twitter @agatan @agatan_
  2. ©2018 Wantedly, Inc. React Redux Vue react-router universal-router Angular styled-components

    webpack-serve Typescript Immutable.js CSS Modules flow prettier preact redux-saga redux-thunk npm esdoc webpack parcel jest mocha jasmin hyperapp Vuex
  3. ©2018 Wantedly, Inc. Mint w IUUQTNJOUMBOHDPN w front-end web ͷͨΊͷϓϩάϥϛϯάݴޠ

    w ੩తܕݕࠪ w SPAsͷͨΊͷ༷ʑͳػೳΛݴޠϨϕϧͰαϙʔτ • Reusable components • Styling • Routing • Global and local state handling • Synchronous and asynchronous computations that might fail
  4. ©2018 Wantedly, Inc. Styling with CSS DPNQPOFOU.BJO\ TUZMFCVUUPO\ CBDLHSPVOESFE DPMPSXIJUF

    CPSEFS ^ GVOSFOEFS)UNM\ CVUUPOCVUUPO \$MJDL.&^ CVUUPO ^ ^ Style ͸ఆٛ͞Εͨcomponentsͷ scopeʹด͡Δ
  5. ©2018 Wantedly, Inc. Routing SPVUFT\ \ "QQMJDBUJPOTFU1BHF JOEFY  ^

     VTFSTJE JE/VNCFS \ EP\ "QQMJDBUJPOTFU1BHF TIPX  "QQMJDBUJPOMPBE6TFS JE  ^ ^ ^
  6. ©2018 Wantedly, Inc. Components DPNQPOFOU5FTU\ QSPQFSUZTJ[F4USJOHTNBMM QSPQFSUZDPMPS4USJOHSFE  GVOSFOEFS)UNM\ EJW

    \DPMPS^ \TJ[F^ EJW ^ ^ React.Component property Λ࣋ͯΔ render ؔ਺Λ࣋ͭ
  7. ©2018 Wantedly, Inc. JavaScript interpolation DPNQPOFOU.BJO\ GVOIBOEMF$MJDL FWFOU)UNM&WFOU 7PJE\ ABMFSU

    )FMMP A ^  GVOSFOEFS)UNM\ EJWPO$MJDL\IBOEMF$MJDL^\$MJDLUPBMFSU^EJW ^ ^
  8. ©2018 Wantedly, Inc. Connect connect Ͱ component ͱ store Λͭͳ͙

    DPNQPOFOU.BJO\ DPOOFDU$PVOUFSFYQPTJOH\DPVOU JODSFNFOU^ GVOSFOEFS)UNM\ EJW \/VNCFSUP4USJOH DPVOU ^ CVUUPOPO$MJDL\ FWFOU)UNM&WFOU 7PJE\ JODSFNFOU  ^^\ ^CVUUPO EJW ^ ^
  9. ©2018 Wantedly, Inc. Component before DPNQPOFOU.BJO\ DPOOFDU$PVOUFSFYQPTJOH\DPVOU JODSFNFOU^ GVOSFOEFS)UNM\ EJW

    \/VNCFSUP4USJOH DPVOU ^ CVUUPOPO$MJDL\ FWFOU)UNM&WFOU 7PJE\ JODSFNFOU  ^^\ ^CVUUPO EJW ^ ^
  10. ©2018 Wantedly, Inc. Component after DMBTT.BJOFYUFOET$PNQPOFOU\ HFUDPVOU \SFUVSO$PVOUFSDPVOU^ JODSFNFOU QBSBNT

    \SFUVSO$PVOUFSJODSFNFOU QBSBNT ^ DPNQPOFOU8JMM6ONPVOU \ $PVOUFS@VOTVCTDSJCF UIJT  ^ DPNQPOFOU%JE.PVOU \ $PVOUFS@TVCTDSJCF UIJT  ^ SFOEFS \ SFUVSO@DSFBUF&MFNFOU EJW \^ </VNCFSUP4USJOH UIJTDPVOU @DSFBUF&MFNFOU CVUUPO \ PO$MJDL FWFOU FWFOU \ SFUVSOUIJTJODSFNFOUCJOE UIJT  ^ @OPSNBMJ[F&WFOU FWFOU  ^ <A A> >  ^ ^
  11. ©2018 Wantedly, Inc. Store before & after DPOTU$PVOUFSOFX DMBTTFYUFOET4UPSF\ DPOTUSVDUPS

    \ TVQFS  UIJTTUBUF\ DPVOU ^ ^ HFUDPVOU \SFUVSOUIJTTUBUFDPVOU^ JODSFNFOU \ SFUVSOOFX1SPNJTF @SFTPMWF \ UIJTTFU4UBUF @VQEBUF UIJTTUBUF OFX3FDP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