SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
react-starter-kitで
とっとと始める
isomorphic開発
株式会社エクストーン 豊田陽一
agenda
● what is “isomorphic”?
● react-starter-kit (https://github.com/kriasoft/react-starter-kit)
● create test page
● check device
what is
isomorphic?
what is “isomorphic”?
● code sharing with client and server
○ Routing
○ Model
○ Rendering
○ etc.
topic
● singleton free
● hydrating
● routing
● fetching
Isomorphic Survival Guide
● https://speakerdeck.com/koichik/isomorphic-survival-guide
react-starter-kit
react-starter-kit
● "isomorphic" web app boilerplate
○ Node.js
○ Express
○ GraphQL
○ React
○ with modern web development tools
■ Webpack
■ Babel
■ Browsersync
prerequisite
● Node.js v5.0 or newer
● npm v3.3 or newer
● node-gyp prerequisited
○ python v2.7
○ make, gcc (or Xcode or Visual C++ Build Tools or any toolchains)
● text editor or IDE
getting started
● git clone https://github.com/kriasoft/react-starter-kit.git MyApp
● cd MyApp
● npm install
● npm start
○ http://localhost:3000/ - Node.js server (build/server.js)
○ http://localhost:3000/graphql - GraphQL server and IDE
○ http://localhost:3001/ - BrowserSync proxy with HMR, React Hot Transform
○ http://localhost:3002/ - BrowserSync control panel (UI)
create test page
directory layout
.
├── /build/ # The folder for compiled output
├── /docs/ # Documentation files for the project
├── /node_modules/ # 3rd-party libraries and utilities
├── /src/ # The source code of the application
│ ├── /components/ # React components
│ ├── /content/ # Static pages like About Us, Privacy Policy etc.
│ ├── /core/ # Core framework and utility functions
│ ├── /data/ # GraphQL server schema and data models
│ ├── /public/ # Static files which are copied into the /build/public folder
│ ├── /routes/ # Page/screen components along with the routing information
│ ├── /views/ # Express.js views (templates) for index and error pages
│ ├── /client.js # Client-side startup script
│ ├── /config.js # Global application settings
│ └── /server.js # Server-side startup script
├── /test/ # Unit and end-to-end tests
├── /tools/ # Build automation scripts and utilities
│ ├── /lib/ # Library for utility snippets
│ ├── /build.js # Builds the project from source to output (build) folder
│ ├── /bundle.js # Bundles the web resources into package(s) through Webpack
│ ├── /clean.js # Cleans up the output (build) folder
│ ├── /copy.js # Copies static files to output (build) folder
│ ├── /deploy.js # Deploys your web application
│ ├── /run.js # Helper function for running build automation tasks
│ ├── /runServer.js # Launches (or restarts) Node.js server
│ ├── /start.js # Launches the development web server with "live reload"
│ └── /webpack.config.js # Configurations for client-side and server-side bundles
└── package.json # The list of 3rd party libraries and utilities
initial top page
● http://localhost:3001/
● try to…
○ add test page (only “hello world”)
○ add link to test page on header
edit src/routes/index.js
● top routing
● import child routes
import ...
// Child routes
...
import test from './test';
export default {
path: '/',
children: [
home,
contact,
login,
register,
test,
content,
error
],
...
create src/routes/test
● index.js
○ sub route file (about /test)
○ required from src/routes/index.js
● Test.js
○ top page component (without header, footer)
○ written by React
○ defines <Test> component
● Test.css
○ stylesheet about <Test> component
src/routes/test/index.js
● routes definition file (about /test and
children)
● render top page component
import React from 'react';
import Test from './Test';
export default {
path: '/test',
action() {
return <Test />;
},
};
src/routes/test/Test.js
● describes <Test> component’s definition import React, { PropTypes } from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Test.css';
const title = 'Hello world!';
function Test(props, context) {
context.setTitle(title);
return(
<div className={s.root}>
<div className={s.container}>
<h1>{title}</h1>
<p>This is test.</p>
</div>
</div>
);
}
Test.contextTypes = { setTitle: PropTypes.func.isRequired };
export default withStyles(s)(Test);
src/routes/test/Test.css
● describes <Test> component’s style @import '../../components/variables.css';
.root {
padding-left: 20px;
padding-right: 20px;
}
.container {
margin: 0 auto;
padding: 0 0 40px;
max-width: var(--max-content-width);
}
edit src/components/Navigation.js
● Navigation.js
○ React component <Navigation>
○ header navigation
● add link to test page
import ...
function Navigation({ className }) {
return (
<div className={cx(s.root, className)} role="navigation">
<Link className={s.link} to="/test">Test</Link>
<Link className={s.link} to="/about">About</Link>
<Link className={s.link} to="/contact">Contact</Link>
<span className={s.spacer}> | </span>
<Link className={s.link} to="/login">Log in</Link>
<span className={s.spacer}>or</span>
<Link className={cx(s.link, s.highlight)} to="/register">Sign up</Link>
</div>
);
}
Navigation.propTypes = {
className: PropTypes.string,
};
export default withStyles(s)(Navigation);
http://localhost:3001/
● done!
check device
BrowserSync proxy with HMR
● auto build and reload when update source code
● http://localhost:3001/
● and http://<external ip>:3001/
○ check remote device
■ smartphone
■ tablet
■ IE
■ etc.
remote debug!
● check multiple devices at the same time
● auto reload when code changes

Weitere ähnliche Inhalte

Was ist angesagt?

Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Publicis Sapient Engineering
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and PipelinesSyed Imam
 
Building a deployment pipeline
Building a deployment pipelineBuilding a deployment pipeline
Building a deployment pipelineNoam Shochat
 
JS digest. January 2017
JS digest. January 2017JS digest. January 2017
JS digest. January 2017ElifTech
 
AWS ElasticBeanstalk and Docker
AWS ElasticBeanstalk and Docker AWS ElasticBeanstalk and Docker
AWS ElasticBeanstalk and Docker kloia
 
Mocha, chai and sinon
Mocha, chai and sinonMocha, chai and sinon
Mocha, chai and sinonAndrew Dixon
 
Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Wei-Wen Hsu
 
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of Container
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of ContainerOSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of Container
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of ContainerNETWAYS
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsSetyo Nugroho
 
中華電信 教育訓練
中華電信 教育訓練中華電信 教育訓練
中華電信 教育訓練謝 宗穎
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?Izzet Mustafaiev
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsPhilip Stehlik
 
Building the AO tech blog
Building the AO tech blogBuilding the AO tech blog
Building the AO tech blogAO Tech
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseLINAGORA
 
Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Peter Bittner
 
Golang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with GlideGolang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with GlideRichard Tuin
 
Atmosphere packages and the chuck norris effect
Atmosphere packages and the chuck norris effectAtmosphere packages and the chuck norris effect
Atmosphere packages and the chuck norris effectFabian Kromer
 

Was ist angesagt? (20)

Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
Paris Container Day 2016 : Cloud de conteneurs, conteneurs dans le cloud, str...
 
Deep dive - Concourse CI/CD and Pipelines
Deep dive  - Concourse CI/CD and PipelinesDeep dive  - Concourse CI/CD and Pipelines
Deep dive - Concourse CI/CD and Pipelines
 
Building a deployment pipeline
Building a deployment pipelineBuilding a deployment pipeline
Building a deployment pipeline
 
JS digest. January 2017
JS digest. January 2017JS digest. January 2017
JS digest. January 2017
 
AWS ElasticBeanstalk and Docker
AWS ElasticBeanstalk and Docker AWS ElasticBeanstalk and Docker
AWS ElasticBeanstalk and Docker
 
Mocha, chai and sinon
Mocha, chai and sinonMocha, chai and sinon
Mocha, chai and sinon
 
Asm.js introduction
Asm.js introductionAsm.js introduction
Asm.js introduction
 
Cycle.js overview
Cycle.js overviewCycle.js overview
Cycle.js overview
 
Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++Using openCV 2.0 with Dev C++
Using openCV 2.0 with Dev C++
 
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of Container
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of ContainerOSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of Container
OSDC 2017 - Dr. Udo Seidel - VMwares (open source) Way of Container
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
中華電信 教育訓練
中華電信 教育訓練中華電信 教育訓練
中華電信 教育訓練
 
[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?[Szjug] Docker. Does it matter for java developer?
[Szjug] Docker. Does it matter for java developer?
 
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James WilliamsSF Grails - Ratpack - Compact Groovy Webapps - James Williams
SF Grails - Ratpack - Compact Groovy Webapps - James Williams
 
Building the AO tech blog
Building the AO tech blogBuilding the AO tech blog
Building the AO tech blog
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entreprise
 
Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)
 
Golang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with GlideGolang for PHP Developers: Dependency management with Glide
Golang for PHP Developers: Dependency management with Glide
 
Atmosphere packages and the chuck norris effect
Atmosphere packages and the chuck norris effectAtmosphere packages and the chuck norris effect
Atmosphere packages and the chuck norris effect
 
CI and CD
CI and CDCI and CD
CI and CD
 

Ähnlich wie React starter-kitでとっとと始めるisomorphic開発

Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerApplitools
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureIgalia
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausWomen in Technology Poland
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and PracticeBo-Yi Wu
 
Monitoring Kafka w/ Prometheus
Monitoring Kafka w/ PrometheusMonitoring Kafka w/ Prometheus
Monitoring Kafka w/ Prometheuskawamuray
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013Andy Bunce
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsOWASP Kyiv
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovyjgcloudbees
 
Drupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersDrupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersnuppla
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausWomen in Technology Poland
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with DjangoRoger Barnes
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageAndrii Lundiak
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Codemotion
 

Ähnlich wie React starter-kitでとっとと始めるisomorphic開発 (20)

Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
Monitoring Kafka w/ Prometheus
Monitoring Kafka w/ PrometheusMonitoring Kafka w/ Prometheus
Monitoring Kafka w/ Prometheus
 
BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013BaseX user-group-talk XML Prague 2013
BaseX user-group-talk XML Prague 2013
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovy
 
JavaScript Unit Testing
JavaScript Unit TestingJavaScript Unit Testing
JavaScript Unit Testing
 
Drupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developersDrupalcon 2021 - Nuxt.js for drupal developers
Drupalcon 2021 - Nuxt.js for drupal developers
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
Towards Continuous Deployment with Django
Towards Continuous Deployment with DjangoTowards Continuous Deployment with Django
Towards Continuous Deployment with Django
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
 

Mehr von Yoichi Toyota

超フランクにスクラムの大事なことの話をする
超フランクにスクラムの大事なことの話をする超フランクにスクラムの大事なことの話をする
超フランクにスクラムの大事なことの話をするYoichi Toyota
 
ジャワカレーをおいしく作る最後の一押し
ジャワカレーをおいしく作る最後の一押しジャワカレーをおいしく作る最後の一押し
ジャワカレーをおいしく作る最後の一押しYoichi Toyota
 
ライブラリを作る思考回路
ライブラリを作る思考回路ライブラリを作る思考回路
ライブラリを作る思考回路Yoichi Toyota
 
DynamoDB設計のちょっとした技
DynamoDB設計のちょっとした技DynamoDB設計のちょっとした技
DynamoDB設計のちょっとした技Yoichi Toyota
 
はじめてのDynamoDBスキーマ設計
はじめてのDynamoDBスキーマ設計はじめてのDynamoDBスキーマ設計
はじめてのDynamoDBスキーマ設計Yoichi Toyota
 
オブジェクト指向についてあまり知られていないこと
オブジェクト指向についてあまり知られていないことオブジェクト指向についてあまり知られていないこと
オブジェクト指向についてあまり知られていないことYoichi Toyota
 
Ruby is comming ractor編
Ruby is comming ractor編Ruby is comming ractor編
Ruby is comming ractor編Yoichi Toyota
 
array.map(&:key)ってなんやねん
array.map(&:key)ってなんやねんarray.map(&:key)ってなんやねん
array.map(&:key)ってなんやねんYoichi Toyota
 
はじめてのPull Request
はじめてのPull RequestはじめてのPull Request
はじめてのPull RequestYoichi Toyota
 
Railsの開発環境作るぞ
Railsの開発環境作るぞRailsの開発環境作るぞ
Railsの開発環境作るぞYoichi Toyota
 
jqで極めるシェル芸の話
jqで極めるシェル芸の話jqで極めるシェル芸の話
jqで極めるシェル芸の話Yoichi Toyota
 
足し算をつくろう
足し算をつくろう足し算をつくろう
足し算をつくろうYoichi Toyota
 
React Hooksでカスタムフックをつくろう
React HooksでカスタムフックをつくろうReact Hooksでカスタムフックをつくろう
React HooksでカスタムフックをつくろうYoichi Toyota
 
ActionCableのクライアントはRails外から利用できるのか
ActionCableのクライアントはRails外から利用できるのかActionCableのクライアントはRails外から利用できるのか
ActionCableのクライアントはRails外から利用できるのかYoichi Toyota
 
サーバーレスアプリケーションの作り方
サーバーレスアプリケーションの作り方サーバーレスアプリケーションの作り方
サーバーレスアプリケーションの作り方Yoichi Toyota
 
SPA時代のOGPとの戦い方
SPA時代のOGPとの戦い方SPA時代のOGPとの戦い方
SPA時代のOGPとの戦い方Yoichi Toyota
 
AWS WAFでらくらくファイアーウォール生活
AWS WAFでらくらくファイアーウォール生活AWS WAFでらくらくファイアーウォール生活
AWS WAFでらくらくファイアーウォール生活Yoichi Toyota
 
Docker in production
Docker in productionDocker in production
Docker in productionYoichi Toyota
 
How to fight against “full scratch disease”
How to fight against  “full scratch disease”How to fight against  “full scratch disease”
How to fight against “full scratch disease”Yoichi Toyota
 
Amazon lexを触ってみた
Amazon lexを触ってみたAmazon lexを触ってみた
Amazon lexを触ってみたYoichi Toyota
 

Mehr von Yoichi Toyota (20)

超フランクにスクラムの大事なことの話をする
超フランクにスクラムの大事なことの話をする超フランクにスクラムの大事なことの話をする
超フランクにスクラムの大事なことの話をする
 
ジャワカレーをおいしく作る最後の一押し
ジャワカレーをおいしく作る最後の一押しジャワカレーをおいしく作る最後の一押し
ジャワカレーをおいしく作る最後の一押し
 
ライブラリを作る思考回路
ライブラリを作る思考回路ライブラリを作る思考回路
ライブラリを作る思考回路
 
DynamoDB設計のちょっとした技
DynamoDB設計のちょっとした技DynamoDB設計のちょっとした技
DynamoDB設計のちょっとした技
 
はじめてのDynamoDBスキーマ設計
はじめてのDynamoDBスキーマ設計はじめてのDynamoDBスキーマ設計
はじめてのDynamoDBスキーマ設計
 
オブジェクト指向についてあまり知られていないこと
オブジェクト指向についてあまり知られていないことオブジェクト指向についてあまり知られていないこと
オブジェクト指向についてあまり知られていないこと
 
Ruby is comming ractor編
Ruby is comming ractor編Ruby is comming ractor編
Ruby is comming ractor編
 
array.map(&:key)ってなんやねん
array.map(&:key)ってなんやねんarray.map(&:key)ってなんやねん
array.map(&:key)ってなんやねん
 
はじめてのPull Request
はじめてのPull RequestはじめてのPull Request
はじめてのPull Request
 
Railsの開発環境作るぞ
Railsの開発環境作るぞRailsの開発環境作るぞ
Railsの開発環境作るぞ
 
jqで極めるシェル芸の話
jqで極めるシェル芸の話jqで極めるシェル芸の話
jqで極めるシェル芸の話
 
足し算をつくろう
足し算をつくろう足し算をつくろう
足し算をつくろう
 
React Hooksでカスタムフックをつくろう
React HooksでカスタムフックをつくろうReact Hooksでカスタムフックをつくろう
React Hooksでカスタムフックをつくろう
 
ActionCableのクライアントはRails外から利用できるのか
ActionCableのクライアントはRails外から利用できるのかActionCableのクライアントはRails外から利用できるのか
ActionCableのクライアントはRails外から利用できるのか
 
サーバーレスアプリケーションの作り方
サーバーレスアプリケーションの作り方サーバーレスアプリケーションの作り方
サーバーレスアプリケーションの作り方
 
SPA時代のOGPとの戦い方
SPA時代のOGPとの戦い方SPA時代のOGPとの戦い方
SPA時代のOGPとの戦い方
 
AWS WAFでらくらくファイアーウォール生活
AWS WAFでらくらくファイアーウォール生活AWS WAFでらくらくファイアーウォール生活
AWS WAFでらくらくファイアーウォール生活
 
Docker in production
Docker in productionDocker in production
Docker in production
 
How to fight against “full scratch disease”
How to fight against  “full scratch disease”How to fight against  “full scratch disease”
How to fight against “full scratch disease”
 
Amazon lexを触ってみた
Amazon lexを触ってみたAmazon lexを触ってみた
Amazon lexを触ってみた
 

Kürzlich hochgeladen

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

React starter-kitでとっとと始めるisomorphic開発

  • 2. agenda ● what is “isomorphic”? ● react-starter-kit (https://github.com/kriasoft/react-starter-kit) ● create test page ● check device
  • 4. what is “isomorphic”? ● code sharing with client and server ○ Routing ○ Model ○ Rendering ○ etc.
  • 5. topic ● singleton free ● hydrating ● routing ● fetching
  • 6. Isomorphic Survival Guide ● https://speakerdeck.com/koichik/isomorphic-survival-guide
  • 8. react-starter-kit ● "isomorphic" web app boilerplate ○ Node.js ○ Express ○ GraphQL ○ React ○ with modern web development tools ■ Webpack ■ Babel ■ Browsersync
  • 9. prerequisite ● Node.js v5.0 or newer ● npm v3.3 or newer ● node-gyp prerequisited ○ python v2.7 ○ make, gcc (or Xcode or Visual C++ Build Tools or any toolchains) ● text editor or IDE
  • 10. getting started ● git clone https://github.com/kriasoft/react-starter-kit.git MyApp ● cd MyApp ● npm install ● npm start ○ http://localhost:3000/ - Node.js server (build/server.js) ○ http://localhost:3000/graphql - GraphQL server and IDE ○ http://localhost:3001/ - BrowserSync proxy with HMR, React Hot Transform ○ http://localhost:3002/ - BrowserSync control panel (UI)
  • 12. directory layout . ├── /build/ # The folder for compiled output ├── /docs/ # Documentation files for the project ├── /node_modules/ # 3rd-party libraries and utilities ├── /src/ # The source code of the application │ ├── /components/ # React components │ ├── /content/ # Static pages like About Us, Privacy Policy etc. │ ├── /core/ # Core framework and utility functions │ ├── /data/ # GraphQL server schema and data models │ ├── /public/ # Static files which are copied into the /build/public folder │ ├── /routes/ # Page/screen components along with the routing information │ ├── /views/ # Express.js views (templates) for index and error pages │ ├── /client.js # Client-side startup script │ ├── /config.js # Global application settings │ └── /server.js # Server-side startup script ├── /test/ # Unit and end-to-end tests ├── /tools/ # Build automation scripts and utilities │ ├── /lib/ # Library for utility snippets │ ├── /build.js # Builds the project from source to output (build) folder │ ├── /bundle.js # Bundles the web resources into package(s) through Webpack │ ├── /clean.js # Cleans up the output (build) folder │ ├── /copy.js # Copies static files to output (build) folder │ ├── /deploy.js # Deploys your web application │ ├── /run.js # Helper function for running build automation tasks │ ├── /runServer.js # Launches (or restarts) Node.js server │ ├── /start.js # Launches the development web server with "live reload" │ └── /webpack.config.js # Configurations for client-side and server-side bundles └── package.json # The list of 3rd party libraries and utilities
  • 13. initial top page ● http://localhost:3001/ ● try to… ○ add test page (only “hello world”) ○ add link to test page on header
  • 14. edit src/routes/index.js ● top routing ● import child routes import ... // Child routes ... import test from './test'; export default { path: '/', children: [ home, contact, login, register, test, content, error ], ...
  • 15. create src/routes/test ● index.js ○ sub route file (about /test) ○ required from src/routes/index.js ● Test.js ○ top page component (without header, footer) ○ written by React ○ defines <Test> component ● Test.css ○ stylesheet about <Test> component
  • 16. src/routes/test/index.js ● routes definition file (about /test and children) ● render top page component import React from 'react'; import Test from './Test'; export default { path: '/test', action() { return <Test />; }, };
  • 17. src/routes/test/Test.js ● describes <Test> component’s definition import React, { PropTypes } from 'react'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import s from './Test.css'; const title = 'Hello world!'; function Test(props, context) { context.setTitle(title); return( <div className={s.root}> <div className={s.container}> <h1>{title}</h1> <p>This is test.</p> </div> </div> ); } Test.contextTypes = { setTitle: PropTypes.func.isRequired }; export default withStyles(s)(Test);
  • 18. src/routes/test/Test.css ● describes <Test> component’s style @import '../../components/variables.css'; .root { padding-left: 20px; padding-right: 20px; } .container { margin: 0 auto; padding: 0 0 40px; max-width: var(--max-content-width); }
  • 19. edit src/components/Navigation.js ● Navigation.js ○ React component <Navigation> ○ header navigation ● add link to test page import ... function Navigation({ className }) { return ( <div className={cx(s.root, className)} role="navigation"> <Link className={s.link} to="/test">Test</Link> <Link className={s.link} to="/about">About</Link> <Link className={s.link} to="/contact">Contact</Link> <span className={s.spacer}> | </span> <Link className={s.link} to="/login">Log in</Link> <span className={s.spacer}>or</span> <Link className={cx(s.link, s.highlight)} to="/register">Sign up</Link> </div> ); } Navigation.propTypes = { className: PropTypes.string, }; export default withStyles(s)(Navigation);
  • 22. BrowserSync proxy with HMR ● auto build and reload when update source code ● http://localhost:3001/ ● and http://<external ip>:3001/ ○ check remote device ■ smartphone ■ tablet ■ IE ■ etc.
  • 23. remote debug! ● check multiple devices at the same time ● auto reload when code changes