SlideShare ist ein Scribd-Unternehmen logo
1 von 21
ISOMORPHIC
JAVASCRIPT
Tyler Peterson
@managerJS
October 2015
AKA • Isomorphic
• Universal
– Not to be confused with a
Universal Module
• Portable
Isomorphic
JavaScript
• Narrowly: Same Code
Renders Markup on
Server and Client
– React, Rendr, Meteor
• Broadly: CodeThat Is At
Home on the Server and
the Browser.
– Superagent, lo-dash, Q
Presented by FamilySearch
Significant
Common
Ground
• JavaScript language:
prototypes, expressions,
functions as objects.
• JavaScript libs such as Math,
Date, Error, JSON, RegExp.
• Can solve a lot of problems
without running into
inconsistencies.
Libraries
Built on
Common
Ground
• The community already
has interest in creating
libs built on common
ground and easily loaded
in the browser or node.
– Ex: Q, underscore/lodash,
moment.js, Chai
Inconsistencies
In the Browser
• XMLHttpRequest()
• DOM
• Local storage et al.
In Node
• http.request()
• None/Replacement (React)
• Files and databases
Presented by FamilySearch
Fighting
Inconsistency?
• Push it up
• Push it down
• Detect and differentiate
Pushing
Inconsistency
Up
• Make your caller deal with
it
• Accept the fruits
– Example: use a hierarchy of
React components. Only at the
top do you differentiate
between React.render() and
ReactDomServer.renderToString().
Pushing
Inconsistency
Down
• Make a dependency deal
with it
• Interact with a façade
– Example: Have a service that fetches
data. Consumers act like data is
fetched uniformly. Under the covers
it uses different URLs inside the data-
center versus outside the firewall.
Lots
Already
Pushed
Down
• The community is already
attracted to pushing
inconsistency down into
universal libraries.
– Ex: superagent
Detect and
Differentiate
• if (typeof window ===
‘undefined’) you’re on the
server, bub.
• Can add sentinels,
depending on your
control
Packaging • Pick something that lets
you transparently use
modules in node or in
Browser.
– WebPack is gaining popularity
– Browserify does the job, too
Trending:
Browserify
vs.
WebPack
https://www.google.com/trends/explore#q=browserify%2C%20webpack&cmpt=q&tz=Etc%2FGMT%2B6
October 14, 2015
Setting up
WebPack
(with React)
• Check out Radu Brehar’s
instructions at
http://jslog.com/2014/10/
02/react-with-webpack-
part-1/
– Some updates in the code at
https://github.com/tylerpeterso
n/isojs
How Useful
Is This
Anyway?
• Perspective of a Library
Author
• Perspective of an App
Author
As a Lib
Author
• If meant for common use,
you should make your code
into a universal module at a
the minimum. Be kind to
your users.
• Your library might target
one environment at first
and be useful enough to
shim to work in both.
As App
Author
• Let’s you write logic once
and run in both places
– Caution: Different concerns on
client and server.
• Many new ideas haven’t
been fully explored
React
Changes
Applicability
• I’m using react in my demos
because portable UI
increases the possibilities of
universal JS.
• Now you can push
inconsistency above, below,
or into the UI and still have a
large amount of Universal
JavaScript.
Demo:
Rendering
Portability
• Example of rendering
your page entirely on
server or entirely in client.
– https://github.com/DavidWells/i
somorphic-react-example
Demo:
Request
Hand-off
• Start all the work on the
server, stream above-the-
fold content, respond to
bandwidth in a beacon
feedback loop, let client
finish up the work.
– https://github.com/tylerpeterso
n/isojs
Thank You! • Tyler Peterson
– ty@managerjs.com
– @ManagerJS

Weitere ähnliche Inhalte

Was ist angesagt?

Rapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web ArchitecturesRapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web Architectures
Keith Fitzgerald
 

Was ist angesagt? (20)

Hacking the way you work
Hacking the way you workHacking the way you work
Hacking the way you work
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
Drupal, git and sanity
Drupal, git and sanityDrupal, git and sanity
Drupal, git and sanity
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
 
Introduction to JS frameworks
Introduction to JS frameworksIntroduction to JS frameworks
Introduction to JS frameworks
 
VJUG 24 - Building microservices with Vert.x
VJUG 24 - Building microservices with Vert.xVJUG 24 - Building microservices with Vert.x
VJUG 24 - Building microservices with Vert.x
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
Reusability is the goal
Reusability is the goalReusability is the goal
Reusability is the goal
 
Supporting large scale React applications
Supporting large scale React applicationsSupporting large scale React applications
Supporting large scale React applications
 
Malmberg meetup June 2018 - Building microservices with Vert.x
Malmberg meetup June 2018 - Building microservices with Vert.xMalmberg meetup June 2018 - Building microservices with Vert.x
Malmberg meetup June 2018 - Building microservices with Vert.x
 
Rapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web ArchitecturesRapidly Building and Deploying Scalable Web Architectures
Rapidly Building and Deploying Scalable Web Architectures
 
Building large scalable mission critical business applications on the web
Building large scalable mission critical business applications on the webBuilding large scalable mission critical business applications on the web
Building large scalable mission critical business applications on the web
 
Microfrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased basedMicrofrontends Monoreops & Trunkbased based
Microfrontends Monoreops & Trunkbased based
 
Front-End Tools and Workflows
Front-End Tools and WorkflowsFront-End Tools and Workflows
Front-End Tools and Workflows
 
Creating Hyper Performant Web Apps with React
Creating Hyper Performant Web Apps with ReactCreating Hyper Performant Web Apps with React
Creating Hyper Performant Web Apps with React
 
Introduction to Web Technology Stacks
Introduction to Web Technology StacksIntroduction to Web Technology Stacks
Introduction to Web Technology Stacks
 
Dublin JUG February 2018 - Building microservices with Vert.x
Dublin JUG February 2018 - Building microservices with Vert.xDublin JUG February 2018 - Building microservices with Vert.x
Dublin JUG February 2018 - Building microservices with Vert.x
 
Vert.x NL meetup October 2017 - Building microservices with Vert.x
Vert.x NL meetup October 2017 - Building microservices with Vert.xVert.x NL meetup October 2017 - Building microservices with Vert.x
Vert.x NL meetup October 2017 - Building microservices with Vert.x
 
Don't worry with bower
Don't worry with bowerDon't worry with bower
Don't worry with bower
 
An evening with React Native
An evening with React NativeAn evening with React Native
An evening with React Native
 

Ähnlich wie Isomorphic JavaScript with Node, WebPack, and React

Choosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkitChoosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkit
Hristo Chakarov
 

Ähnlich wie Isomorphic JavaScript with Node, WebPack, and React (20)

Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiya
 
Frontend War: Angular vs React vs Vue
Frontend War: Angular vs React vs VueFrontend War: Angular vs React vs Vue
Frontend War: Angular vs React vs Vue
 
Isomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the webIsomorphic JavaScript – future of the web
Isomorphic JavaScript – future of the web
 
About javascript libraries
About javascript librariesAbout javascript libraries
About javascript libraries
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript FrameworksBuilding Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
 
Stop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal developmentStop making, start composing - Using Composer for Drupal development
Stop making, start composing - Using Composer for Drupal development
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 
Welcome to React.pptx
Welcome to React.pptxWelcome to React.pptx
Welcome to React.pptx
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Frontend as a first class citizen
Frontend as a first class citizenFrontend as a first class citizen
Frontend as a first class citizen
 
Choosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkitChoosing the best JavaScript framework/library/toolkit
Choosing the best JavaScript framework/library/toolkit
 
Learn from my Mistakes - Building Better Solutions in SPFx
Learn from my  Mistakes - Building Better Solutions in SPFxLearn from my  Mistakes - Building Better Solutions in SPFx
Learn from my Mistakes - Building Better Solutions in SPFx
 
Selecting the Best Javascript Web Framework
Selecting the Best Javascript Web FrameworkSelecting the Best Javascript Web Framework
Selecting the Best Javascript Web Framework
 
Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?Angular 2 vs React. What to chose in 2017?
Angular 2 vs React. What to chose in 2017?
 
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...Lessons learned from building Eclipse-based add-ons for commercial modeling t...
Lessons learned from building Eclipse-based add-ons for commercial modeling t...
 
Code the docs-yu liu
Code the docs-yu liuCode the docs-yu liu
Code the docs-yu liu
 

Kürzlich hochgeladen

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Isomorphic JavaScript with Node, WebPack, and React