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

はじめてのSSR

 はじめてのSSR

React + ReduxでSSR+Isomorphicなアプリケーションを作ったときにつまづいた点をまとめました。
Node学園27時限目

More Decks by Taketoshi Aono(青野健利 a.k.a brn)

Other Decks in Programming

Transcript

  1. せ⵸: @brn (ꫬꅿ⨳ⵃa.k.a ـٕ٦ظ) 耵噟: ؿٗٝزؒٝسؒٝآص،٥iOSؒٝآص، ⠓爡: Cyberagent ،سذؙأةآؔRightSegment٥AI Messenger

    ـؚٗ: http://abcdef.gets.b6n.ch/ Twitter: https://twitter.com/brn227 GitHub: https://github.com/brn
  2. Page1 history Page2 history state Page3 history state state וךل٦آחٓٝر؍ؚٝ׃ג׮history.stateָ搀ְل٦آָծ

    SPAך饯挿הז׷ل٦آחז׷կ Page2 history Page1 history state Page3 history state state
  3. import {! matchPath! } from 'react-router';! ! const match =

    matchPath("/article/1", {! path: '/articel/:articleId',! exact: true! });! ! if (match) {! console.log(match.params)! // Object { articleId: 1 }! }!
  4. module.exports = { entry: { server: './server/index.ts' }, target: 'node',

    externals: /^(?!^\.\.?\/)/, output: { path: `${__dirname}/dist`, filename: "[name].js", libraryTarget: "commonjs2" }, resolve: { extensions: [".js", ".ts"] } }
  5. public render() {! return !this.props.shouldRenderStatic! && this.props.isMobile ? (! <LazyLoad

    {...this.props}>! {this.props.children}! </LazyLoad>! ) : this.props.children;! }!