ABOUT ME
TRẦN TRỌNG THANH
▸ CTO & Co-founder NauStud.io
▸ 4 years with ActionScript, ex-Pycorian ;)
▸ 5 years with JavaScript
▸ Have worked with ReactJS, Angular 2, and learning VueJS
▸ SaigonJS FB group curator (bit.ly/saigonjs)
▸ Contact: Twitter/Facebook/Github /trongthanh
Nau is hiring! 😎❤☕
UNIVERSAL JS APPLICATION WITH REACTJS
A BRIEF HISTORY OF WEB APPS
▸ 1992 - Static HTML
▸ 1993 - Server side rendered HTML (CGI protocol)
▸ 1995 - LiveScript (a.k.a JavaScript) in Netscape Nav 2.0
▸ 1997 - Dynamic HTML, Internet Explorer 4
▸ 2005 - AJAX web apps
▸ 2010-ish - JS frameworks and Single page apps (SPA)
A BRIEF HISTORY OF WEB APPS
WHY SPA?
▸ Instant responses on the UI*
▸ No page refresh, allows page transitions
▸ Less overheads at server side
▸ App-like experience
▸ Foundation for Hybrid mobile apps
▸ More emphasis at Front End, enables back-end-less
A BRIEF HISTORY OF WEB APPS
THE ACHILLES’ HILL OF SPA (2015 A.D.)
😞 SEO
😞 First meaningful paint
😞 no-script
<!doctype html>
<html lang="en">
<head>
<title>My Awesome Single Page App</title>
<meta charset="utf-8">
<meta name="viewport" content="...">
<link rel="stylesheet" href="styles.min.css">
</head>
<body>
<div id="root" style="height: 100%"></div>
<script src="bundle.js"></script>
</body>
</html>
* Code sample from react-redux-starter-kit
A BRIEF HISTORY OF WEB APPS
OBVIOUS SOLUTION?
Render content HTML at server-side
MORE PROBLEMS?
😞 Duplicated rendering logic at server side
😞 Double work of template maintenance
😞 Flash of updated content
😞 All the relief of SPA for backend is gone
WHAT IS A
UNIVERSAL JS APPLICATION?
▸ Used to be called Isomorphic JS Applications
▸ There are portions of JS run on both client and server
(hence universal / isomorphic)
▸ Server-side rendered HTML
▸ Server-enabled History Push State