This document discusses integrating React.js into a PHP application. It provides an overview of React.js and its benefits for building user interfaces. It then covers different approaches to server-side rendering (SSR) with React in a PHP application, including using the V8Js PHP extension to run JavaScript, making requests from PHP to a Node.js service, and making requests from Node.js to PHP. It emphasizes that React.js and PHP can complement each other and discusses frameworks like Next.js that support SSR. The key takeaways are that React.js can enhance PHP applications, there are different SSR architectures to integrate them, and giving React.js a try can help modernize app views.
Integrating React.js Into a PHP ApplicationAndrew Rota
React.js has taken the web development world by storm, and for good reason: React offers a declarative, component-oriented approach to building highly-scalable web UIs. But how can we take advantage of a JavaScript library like React in our server-side PHP applications. In this talk l cover the different ways React.js can be integrated into an existing PHP web application: from a client-side only approach to multiple techniques that support full server-side rendering with a Node.js server or PHP’s v8js. I also discuss the trade-offs in each of these designs and the challenges involved with adding React to a PHP site. Most importantly, I consider the higher-level issue of how to improve view cohesion across the client-server divide in a PHP application.
Server side rendering design and development. Review of main server side rendering parts and development process. Next.js React framework for SSR review.
Main contents:
What is SSR?
Prerendering
SSR for popular frameworks
Custom SSR with Node.js and React
SSR with Readux and Mobx state managers.
Next.js
In this talk, Jamie will demonstrate some core principles of a minimalist React framework called Next.js - We’ll also learn why SEO isn’t the only benefit of Server Side Rendering in React.
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개if kakao
황민호(robin.hwang) / kakao corp. DSP개발파트
---
최근 Spring Cloud와 Netflix OSS로 MSA를 구성하는 시스템 기반의 서비스들이 많아지는 추세입니다.
카카오에서도 작년에 오픈한 광고 플랫폼 모먼트에 Spring Cloud 기반의 MSA환경을 구성하여, API Gateway도 적용하였는데 1년 반 정도 운영한 경험을 공유할 예정입니다. 더불어 MSA 환경에서는 API Gateway를 통해 인증을 어떻게 처리하는지 알아보고 OAuth2 기반의 JWT Token을 이용한 인증에 대한 이야기도 함께 나눌 예정입니다.
Integrating React.js Into a PHP ApplicationAndrew Rota
React.js has taken the web development world by storm, and for good reason: React offers a declarative, component-oriented approach to building highly-scalable web UIs. But how can we take advantage of a JavaScript library like React in our server-side PHP applications. In this talk l cover the different ways React.js can be integrated into an existing PHP web application: from a client-side only approach to multiple techniques that support full server-side rendering with a Node.js server or PHP’s v8js. I also discuss the trade-offs in each of these designs and the challenges involved with adding React to a PHP site. Most importantly, I consider the higher-level issue of how to improve view cohesion across the client-server divide in a PHP application.
Server side rendering design and development. Review of main server side rendering parts and development process. Next.js React framework for SSR review.
Main contents:
What is SSR?
Prerendering
SSR for popular frameworks
Custom SSR with Node.js and React
SSR with Readux and Mobx state managers.
Next.js
In this talk, Jamie will demonstrate some core principles of a minimalist React framework called Next.js - We’ll also learn why SEO isn’t the only benefit of Server Side Rendering in React.
카카오 광고 플랫폼 MSA 적용 사례 및 API Gateway와 인증 구현에 대한 소개if kakao
황민호(robin.hwang) / kakao corp. DSP개발파트
---
최근 Spring Cloud와 Netflix OSS로 MSA를 구성하는 시스템 기반의 서비스들이 많아지는 추세입니다.
카카오에서도 작년에 오픈한 광고 플랫폼 모먼트에 Spring Cloud 기반의 MSA환경을 구성하여, API Gateway도 적용하였는데 1년 반 정도 운영한 경험을 공유할 예정입니다. 더불어 MSA 환경에서는 API Gateway를 통해 인증을 어떻게 처리하는지 알아보고 OAuth2 기반의 JWT Token을 이용한 인증에 대한 이야기도 함께 나눌 예정입니다.
This Next.js slide is for the short introduction.
Next.js is a react framework for projection. Some people call it as a full stack react framework. Because we can write both client and server side code on it.
Spend some time working with OpenAPI and gRPC and you’ll notice that these two technologies have a lot in common. Both are open source efforts, both describe APIs, and both promise better experiences for API producers and consumers. So why do we need both? If we do, what value does each provide? What can each project learn from the other? We’ll bring the two together for a side-by-side comparison and pose answers to these and other questions about two API methodologies that will do much to influence the future of networked APIs.
Tutorial Videos: https://www.youtube.com/playlist?list=PLD8nQCAhR3tQ7KXnvIk_v_SLK-Fb2y_k_
Day 1 : Introduction to React, Babel and Webpack
Prerequisites of starting the workshop ( Basic understanding of Node & Express )
What is Virtual DOM?
What is React and why should we use it?
Install and set up React:
a-Using create-react-app
b-From scratch using Babel and Webpack. We will use Webpack Dev Server.
Day 2 : React Basic Concepts
Types of Components: Class-based and Functional based Components
Use of JSX
Parent, Child, and Nested Components
Difference between State and Props
Create and Handle Routes
Component Lifecycle Methods
Create a form and handling form inputs
Use of arrow functions and Spread Operator
Day 3: Advanced Concepts in React
Use of Refs
What are Higher Order Components( HOC )?
How to use HOC
Understanding Context in React
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
도커 무작정 따라하기
- 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커의 기본 개념부터 설치와 사용 방법까지 설명합니다.
더 자세한 내용은 가장 빨리 만나는 도커(Docker)를 참조해주세요~
http://www.pyrasis.com/private/2014/11/30/publish-docker-for-the-really-impatient-book
마이크로서비스 스타일로 만들어진 시스템을 모노리틱 스타일로 이관한 사례와 함께 스프링을 이용해 모듈형 모노리스(modular monoliths)를 만든 경험을 바탕으로 모노리틱/마이크로서비스 보다 본질적인 문제를 제기하고, 문제 해결을 위한 생각을 공유합니다.
https://github.com/arawn/building-modular-monoliths-using-spring
This Next.js slide is for the short introduction.
Next.js is a react framework for projection. Some people call it as a full stack react framework. Because we can write both client and server side code on it.
Spend some time working with OpenAPI and gRPC and you’ll notice that these two technologies have a lot in common. Both are open source efforts, both describe APIs, and both promise better experiences for API producers and consumers. So why do we need both? If we do, what value does each provide? What can each project learn from the other? We’ll bring the two together for a side-by-side comparison and pose answers to these and other questions about two API methodologies that will do much to influence the future of networked APIs.
Tutorial Videos: https://www.youtube.com/playlist?list=PLD8nQCAhR3tQ7KXnvIk_v_SLK-Fb2y_k_
Day 1 : Introduction to React, Babel and Webpack
Prerequisites of starting the workshop ( Basic understanding of Node & Express )
What is Virtual DOM?
What is React and why should we use it?
Install and set up React:
a-Using create-react-app
b-From scratch using Babel and Webpack. We will use Webpack Dev Server.
Day 2 : React Basic Concepts
Types of Components: Class-based and Functional based Components
Use of JSX
Parent, Child, and Nested Components
Difference between State and Props
Create and Handle Routes
Component Lifecycle Methods
Create a form and handling form inputs
Use of arrow functions and Spread Operator
Day 3: Advanced Concepts in React
Use of Refs
What are Higher Order Components( HOC )?
How to use HOC
Understanding Context in React
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
도커 무작정 따라하기
- 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커의 기본 개념부터 설치와 사용 방법까지 설명합니다.
더 자세한 내용은 가장 빨리 만나는 도커(Docker)를 참조해주세요~
http://www.pyrasis.com/private/2014/11/30/publish-docker-for-the-really-impatient-book
마이크로서비스 스타일로 만들어진 시스템을 모노리틱 스타일로 이관한 사례와 함께 스프링을 이용해 모듈형 모노리스(modular monoliths)를 만든 경험을 바탕으로 모노리틱/마이크로서비스 보다 본질적인 문제를 제기하고, 문제 해결을 위한 생각을 공유합니다.
https://github.com/arawn/building-modular-monoliths-using-spring
React JS is a free and open-source front-end JavaScript toolkit for creating UI components-based user interfaces. React can be used to create single-page or mobile applications as a foundation.
VueJS is a progressive JavaScript framework that may be used to create dynamic web interfaces. It’s one of the most well-known frameworks for web development. The view layer is the focus of VueJS. It may be seamlessly integrated into large projects for front-end development.
React Js vs Node Js_ Which Framework to Choose for Your Next Web Applicationadityakumar2080
React js is more of a JavaScript library than a framework that is developed and maintained by Facebook. Initially released in May 2013, it is a tool for building UI components. React js has an MVC or Model View Controller architecture. Node js is an open-source Google Chrome v8 JavaScript framework. The main idea of developing applications in Node js is to execute JavaScript on the server-side.
Ever wondered what React.js or its more common term ‘React’ is and why there is such a buzz about it in the software development community? Well, React is an open-source JavaScript framework and library developed by Facebook and it’s used for building interactive user interfaces and web applications quickly and efficiently with significantly less code than you would with vanilla JavaScript. But we are sure, this won’t be enough for you and to know more about React and learn about its amazing features, GDSC NIT Silchar brings its next session “KICKSTART TO REACT” where we will explore React and how it can be used to build modern and interactive UI websites.
Introduction to web development🌐: HTML, CSS, and JavaScript
Problems with traditional approaches to web development 🤔
Introduction to ReactJS ⚛️: What is React, and why use it for modern web development?
Building a simple web application with React🧑🏻💻👩🏻💻
React.js is an open-source JavaScript library. This front-end framework allows you to develop user interfaces for websites and apps in an organized way.
Node.js uses JavaScript - a language known to millions of developers worldwide - thus giving it a much lower learning curve even for complete beginners. Using Node.js you can build simple Command Line programs or complex enterprise level web applications with equal ease. Node.js is an event-driven, server-side, asynchronous development platform with lightning speed execution. Node.js helps you to code the most complex functionalities in just a few lines of code.
This is a review on react js. Its introduction, how to use it, why to use it. Its uses in the front end development world and its effectiveness and advantages as well. Bhupati Venkat Sai Indla | Yogeshchandra Puranik "Review on React JS" Published in International Journal of Trend in Scientific Research and Development (ijtsrd), ISSN: 2456-6470, Volume-5 | Issue-4 , June 2021, URL: https://www.ijtsrd.compapers/ijtsrd42490.pdf Paper URL: https://www.ijtsrd.comengineering/computer-engineering/42490/review-on-react-js/bhupati-venkat-sai-indla
Combining react with node js to develop successful full stack web applicationsKaty Slemon
Let’s explore why entrepreneurs are keen about using React with Node JS for Efficient Web App development along with a successful React and Node JS case study.
Similar to Integrating React.js Into a PHP Application: Dutch PHP 2019 (20)
Ten practical ways to improve front-end performanceAndrew Rota
Conference talk presented at PHP South Coast 2017. Ten concrete ways to improve web performance, split between quick tactical wins and longer-term overarching strategies.
Conference talk presented on May 12, 2016 at JSDay in Verona, Italy.
The performance of our client-side web applications directly impacts the experience of our users, yet browser performance can be one of the most difficult metrics to reliably track. The best way to improve performance is to collect and monitor a wide range of these metrics over time.
Better PHP-Frontend Integration with Tungsten.jsAndrew Rota
Working with the DOM can often be a frustrating experience, resulting in poor performance and hard-to-track bugs. Modern JS frameworks have sought to make this better, but often ignore server-side integration unless you run JavaScript on the server. But your server infrastructure shouldn’t be dictated by your client-side library choices.
This talk presents the insights we learned while building a virtual DOM powered UI library that integrates with PHP by using a common template language, a unified data model, and shared view components. The result was Tungsten.js, a JS framework that aims to deliver a better user and developer experience.
Presented August 2015 at Boston PHP meetup.
Tungsten.js: Building a Modular FrameworkAndrew Rota
Choosing a JavaScript framework is a difficult decision for any organization, especially considering how fast things change. Fortunately, modular frameworks can provide an alternative to traditional monolithic libraries. This talk presents the insights we learned as we combined modular, lightweight JS libraries to deliver high-performance virtual-DOM driven UI updates alongside fast, server-agnostic, server-side rendering.
Presented at EmpireJS on April 26, 2015. This talk introduces static type checking, and examines the multiple type checking tools available in the JavaScript ecosystem today. It also goes through the steps necessary to add gradual type checking to a legacy codebase, and examines the benefits for doing so.
An Exploration of Frameworks – and Why We Built Our OwnAndrew Rota
Insights drawn from our recent process of evaluating the latest JS frameworks, why we rejected them all to build our own, and why you might consider doing the same.
Co-Presented with Matt DeGennaro on Thursday, March 26, 2015 at BostonJS (http://www.meetup.com/boston_JS/events/221038649/).
The Complementarity of React and Web ComponentsAndrew Rota
On Github: http://andrewrota.github.io/complementarity-of-react-and-web-components-presentation/index.html
The component driven, performance focused approach of React is a perfect complement to the modularity and portability of native HTML Web Components. At first glance, React and Web Components might seem like two radically different solutions to the same problem. But when combined properly they complement each other to create an extremely powerful, expressive framework for developing complex web applications.
Web Components + Backbone: a Game-Changing CombinationAndrew Rota
Web Components promise to change how we think about modularity on the web, and when combined with the structure and organization of Backbone.js we can create portable, dynamic, encapsulated UI modules that fit into any web application.
Given at CSS Dev Conf 2014 in New Orleans on October 14, 2014.
This full presentation written with Web Components can be viewed with Chrome 36+ online at http://andrewrota.github.io/web-components-and-modular-css-presentation/presentation/index.html#0.
The source of the presentation is available on GitHub: https://github.com/andrewrota/web-components-and-modular-css-presentation.
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamtakuyayamamoto1800
In this slide, we show the simulation example and the way to compile this solver.
In this solver, the Helmholtz equation can be solved by helmholtzFoam. Also, the Helmholtz equation with uniformly dispersed bubbles can be simulated by helmholtzBubbleFoam.
Strategies for Successful Data Migration Tools.pptxvarshanayak241
Data migration is a complex but essential task for organizations aiming to modernize their IT infrastructure and leverage new technologies. By understanding common challenges and implementing these strategies, businesses can achieve a successful migration with minimal disruption. Data Migration Tool like Ask On Data play a pivotal role in this journey, offering features that streamline the process, ensure data integrity, and maintain security. With the right approach and tools, organizations can turn the challenge of data migration into an opportunity for growth and innovation.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
8. Agenda
● ⚛ Lightning Introduction to React.js
● 🎨 Getting Started with Client-Side Rendered React
● ⚙ Server-Side Rendering Architectures
■ V8Js PHP Extension
■ PHP Requests to a Node.js Service
■ Node.js Requests to PHP
● ✨ Future of React.js SSR
● 💡Takeaways
19. Declarative
‣ Design views as
“components” which accept
props and return React
elements
‣ React will handle rendering
and re-rendering the DOM
when data changes
function Hello(props) {
return <h1>Hello, {props.name}</h1>;
}
20. Composable
‣ In addition to DOM nodes,
components can also render
other components
‣ You can also render child
components for more
generic “box” components
using props.children.
function Hello(props) {
return <h2>My name is, {props.name}</h2>;
}
function NameBadge(props) {
return (<div>
Welcome to {props.conf} Conference.<br />
{props.children}
</div>)
}
function App() {
return (<div>
<NameBadge conf={'Dutch PHP 2019'}>
<Hello name={'Andrew'} />
</NameBadge>
</div>)
}
21. Encapsulate State
‣ Components can manage
their own encapsulated state
‣ When state is shared across
components, a common
pattern is to lift that state up
to a common ancestor
‣ Libraries such as Redux or
MobX can help with more
complex state management
import {Component} from "react";
class App extends Component {
state = {count: 0};
handleClick = () => {
this.setState(state => {
return {count: state.count + 1}
});
};
render() {
return <div>
<span>Count: {this.state.count} </span>
<button onClick={this.handleClick}>+</button>
</div>;
}
}
22. Adding React.js to your PHP site:
the easy way…
100% Client-Side Rendering
23. Render a React App
‣ Start with the root element
on a page, and use
ReactDOM.render to start the
application
const root = document.getElementById('root');
const App = <h1>Hello, world</h1>;
ReactDOM.render(App, root);
25. Incremental Adoption
‣ A 100% react application
would have a single react
root.
‣ Use ReactDOM.render() to
create multiple roots when
converting an application
‣ In general, convert
components from the
“bottom up” of the view tree
26. But we’ve only partially integrated
React.js into our site...
Enter Server-Side Rendering
31. Render a React App
(Server Side)
‣ Running on the server,
ReactDOMServer.renderToString()
will return a string of HTML
‣ Running on the client,
ReactDOM.hydrate() will
attach the event listeners, and
pick up subsequent rendering
client-side
// Shared
const App = <h1>Hello, world</h1>;
// Server side
ReactDOMServer.renderToString(App);
// Client side
ReactDOM.hydrate(App, root);
32. Universal JavaScript: The same application
code (components) is run on both client and
server.
(sometimes also referred to as Isomorphic JavaScript)
34. Let’s look at a few different possible
architectures.
35. 1. V8Js → running JavaScript from PHP
2. Node.js → requests to a standalone JS service
a. Web requests go to PHP, which then makes requests to
Node.js service for HTML
b. Web requests go to Node.js, which then makes requests to
PHP for data
37. What is V8Js?
A PHP extension which embeds the
V8 JavaScript engine
38. A PHP extension which embeds the
V8 JavaScript engine
1. Install V8Js
○ Try the V8Js Docker
image or a pre-built
binary
○ Or compile latest version
yourself
2. Enable the extension in php
(extension=v8js.so)
40. Execute JS in PHP
‣ With V8js, JS can be executed
from PHP
‣ From this starting point, we
could build a PHP class to
consume JS modules, and
output the result as HTML
<?php
$v8 = new V8Js();
$js = "const name = 'World';";
$js .= "const greeting = 'Hello';";
$js .= "function printGreeting(str) {";
$js .= " return greeting + ‘, ' + str + '!';";
$js .= "}";
$js .= "printGreeting(name);";
echo($v8->executeString($js));
41. Using the V8Js Extension
+ No additional service calls
need to be made
- Builds can be difficult to
maintain
- No built-in Node.js libraries
or tooling available
Client
V8js
44. A JavaScript runtime built on the
V8 engine.
1. Install node.js as a standalone
service; can be on same host,
or another.
2. Your web host may already
support it
○ See official Docker images
○ Or install yourself
45. PHP requests to Node.js
+ Full Node.js support
+ PHP can still handle routing,
and partial view rendering
- Additional service to manage
Client
46. Hypernova: a Node.js service for
server-side rendering JavaScript views
Hypernova
‣ Airbnb open sourced a standalone
Node.js service for rendering React
components: airbnb/hypernova
‣ Wayfair open sourced a PHP client for
Hypernova: wayfair/hypernova-php
48. Node.js requests to PHP
+ Full Node.js support
+ Both views and routes live in
Node.js
- May be difficult to
incrementally migrate to
- PHP is essentially just a data
access layer
Client
49. Next.js: SSR framework for React.js
‣ Next.js is a complete framework for
server-side rendered react in Node.js,
with out-of-the-box support for features
like routing, code splitting, caching, and
data fetching.
51. JS
Loads
Hydrate all at onceStreaming Server Side Rendering
React now supports streaming using ReactDOMServer.renderToNodeStream() .
We can use HTML Chunked Encoding to flush content as its rendered ready
(e.g., PHP’s ob_flush() ).
Streaming SSR
52. Load JS incrementally for progressive hydration
Streaming Server Side Rendering
Streaming SSR w/ Partial Hydration