SlideShare uma empresa Scribd logo
1 de 42
Remix
By Rahul Mohan and Mohammed Farhan
Speakers
• Rahul Mohan, Talentica Software
• Mohammed Farhan, Talentica Software
2
Some Prerequisite
• ReactJS
• What is SSR, CSR, SSG.
• SSR (Server-side rendering) : The good old days of PHP and
templating languages.
• SSR is faster but can be more costly in terms of deployment (thin
client) can’t be cached in end nodes (CDN’s)
• Pros of SSR:
• Social media-friendly.
• SEO friendly.
• Fast First Concertful Paint (FCP).
• Up-to-date content.
3
SSR,CSR,SSG
Cons:
• Slow TTFB
• Server-intensive workloads
• Can’t be cached by traditional CDNs
• Navigating across a site is slow without universal rendering
• TTI is longer than FTP with universal rendering
4
SSR,CSR,SSG
• SSR (Static side Rendering)
• Build the pages at run time, this was what the original web was
made on, but new frameworks have made this a good
alternative.
• Pros of SSG:
• Fast load times
• SEO friendly
• Cons of SSG:
• Problematic for sites with many pages
• No personalization
• Content may be stale
5
SSR,CSR,SSG
• Cons of SSG:
• Problematic for sites with many pages
• No personalization
• Content may be stale
6
SSR,CSR,SSG
• Client-Side Rendering
This everyone is known as react become very prevalent in the
last five years.
• Pros:
• Very responsive sites
• No need to wait for pages to be loaded
• Easy in a production env lower build times with the code-
base as static page assets don’t need to be built.
7
SSR,CSR,SSG
• Cons
• Hard to make is SEO Friendly (Google new ranking
algorithm)
• Bigger bundle sizes and slow first conceitful page.
• Not he best option for very thin client there is a JS
overhead.
8
Why Remix ?
• A Runtime for React
• Component + API Route (write your server-side code and
components in the same file).
• Cut down the API overheads of any fetch.
• Avoid the standard Pattern:
• <form method=“post” onSubmit={event => {
event.preventDefault();
}}
• Create state to manage data.
• Use effect hook to update UI.
9
Why Remix ?
• Use the form (browser) like the good old days of
PHP let the browser manage the state.
• useLoaderData,useActionData,useTransition
• Amazing error bounders on the sever side code
and the frontend side.
10
Why Remix ?
11
Prerequisites-The dev setup
12
• Node.js 14 or greater(Preferred 16)
• npm 7 or greater
Initial setup
• npx create-remix@latest
• Follow along with the defaults use some other
service if you want to have another server. (remix
app serer should do fine for now)
• cd project_name
13
Initial setup
14
The file Structure
15
The file Structure
16
• app/ - This is where all your Remix app code goes
• app/entry.client.tsx - This is the first bit of your JavaScript that will run when the
app loads in the browser. We use this file to hydrate our React components.
• app/entry.server.tsx - This is the first bit of your JavaScript that will run when a
request hits your server. Remix handles loading all the necessary data and
you're responsible for sending back the response. We'll use this file to render our
React app to a string/stream and send that as our response to the client.
• app/root.tsx - This is where we put the root component for our application. You
render the <html> element here.
• app/routes/ - This is where all your "route modules" will go. Remix uses the files
in this directory to create the URL routes for your app based on the name of the
files.
• public/ - This is where your static assets go (images/fonts/etc)
• remix.config.js - Remix has a handful of configuration options you can set in this
file.
The file Structure
17
• Let’s delete the files and start a new project
The file Structure
18
• Change your root
Routes
• /
• /blog
• /blog/:blogID
• /blog/new
• /login
19
Old way of routes
20
Routes: app/routes/index.tsx
21
Routes: app/root.tsx
22
Routes: Nested Routes
23
Routes: Nested Routes
24
Routes: Nested Routes
25
Routes: Parameterized Routes
26
Style and all that jazz
• We are going back to the good old days of stylesheets
27
Style and all that jazz
28
Style and all that jazz
29
Some Boring but important DB setup
30
• As this has nothing to do with react in general, I will be breezing
through most of it, but you can use any ORM you please and use
any underlying DB or API you please
• We will be using Prisma
• And a local DB
LoaderFunction,useLoaderData,Link
• LoaderFunction: This is simply an async
function you export that returns a response
• useLoaderData: The hook that replaces all
the other use hooks on your fronted
• Link: Similar to the one we all know and love
from react-router.
31
AUTHENTICATION - Process of recognizing a user's identity
 Password based authentication
 In web world HTTP cookies is the way to use for
authentication.
 HTTP Cookies – Server sends small piece of data to user’
browser and it stores it and sends back to server with later
request for user specific authentication.
 How to set cookie ?
 Set-Cookie: <cookie-name>=<cookie-value>
32
33
Remix‘s Session
 Allow server to identify if request coming form same person
 Remix comes with pre-built session storage options.
1. CreateCookieSessionStorage
2. createMemorySessionStorage
3. CreateFileSessionStorage
4. CreateCloudflareKVSessionStorage(cloudflare-workers)
5. CreateSessionStorage(Custom)
34
How to create cookie session with Remix ?
35
Error handling
 Error handling in remix is stellar
 Route modules has Error Boundary component exported and used
 Error Boundary also works on server errors, action and loaders.
 Error Boundary is some kind of same that we have in REACT16
36
export function ErrorBoundary() {
}
Unexpected Error handling
Error those are not known or guessed it could be catch with this
Expected Error handling
Error those are known and based on that dev can display information to user
SEO With Meta tags
 Remix has meta export for route modules
 <Meta/> Tag for app/root.tsx . It’s in built.
Resource Routing
 Renders other than HTML document like CSV data, image, RSS feed.
 Crete a file under routes jokes[.]rss.tsx
Remix can work without loading JavaScript to the page ?
Thank You

Mais conteúdo relacionado

Mais procurados

JSF2.2で簡単webアプリケーション開発
JSF2.2で簡単webアプリケーション開発JSF2.2で簡単webアプリケーション開発
JSF2.2で簡単webアプリケーション開発
Masuji Katoda
 

Mais procurados (20)

JSF2.2で簡単webアプリケーション開発
JSF2.2で簡単webアプリケーション開発JSF2.2で簡単webアプリケーション開発
JSF2.2で簡単webアプリケーション開発
 
Universal React apps in Next.js
Universal React apps in Next.jsUniversal React apps in Next.js
Universal React apps in Next.js
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Nginx
NginxNginx
Nginx
 
Database Change Management as a Service
Database Change Management as a ServiceDatabase Change Management as a Service
Database Change Management as a Service
 
MySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & GrafanaMySQL Monitoring using Prometheus & Grafana
MySQL Monitoring using Prometheus & Grafana
 
Sug bangalore - headless jss
Sug bangalore - headless jssSug bangalore - headless jss
Sug bangalore - headless jss
 
K8s beginner 2_advanced_ep02_201904221130_post
K8s beginner 2_advanced_ep02_201904221130_postK8s beginner 2_advanced_ep02_201904221130_post
K8s beginner 2_advanced_ep02_201904221130_post
 
Getting started with Next.js
Getting started with Next.jsGetting started with Next.js
Getting started with Next.js
 
Redux toolkit
Redux toolkitRedux toolkit
Redux toolkit
 
Nextjs13.pptx
Nextjs13.pptxNextjs13.pptx
Nextjs13.pptx
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
Rest API
Rest APIRest API
Rest API
 
Lezione 8: Introduzione ai Web Service
Lezione 8: Introduzione ai Web ServiceLezione 8: Introduzione ai Web Service
Lezione 8: Introduzione ai Web Service
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Swoole w PHP. Czy to ma sens?
Swoole w PHP. Czy to ma sens?Swoole w PHP. Czy to ma sens?
Swoole w PHP. Czy to ma sens?
 
React Router: React Meetup XXL
React Router: React Meetup XXLReact Router: React Meetup XXL
React Router: React Meetup XXL
 
Docker
DockerDocker
Docker
 
Apache Server Tutorial
Apache Server TutorialApache Server Tutorial
Apache Server Tutorial
 
Systemes authentification
Systemes authentificationSystemes authentification
Systemes authentification
 

Semelhante a Remix

AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2
Sean Braymen
 

Semelhante a Remix (20)

PAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark TomlinsonPAC 2019 virtual Mark Tomlinson
PAC 2019 virtual Mark Tomlinson
 
Performance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React ApplicationsPerformance and Scalability Art of Isomorphic React Applications
Performance and Scalability Art of Isomorphic React Applications
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
 
#Webperf Choreography
#Webperf Choreography#Webperf Choreography
#Webperf Choreography
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experience
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
 
RESTful web
RESTful webRESTful web
RESTful web
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)
 
Delivering Mobile Apps That Perform
Delivering Mobile Apps That PerformDelivering Mobile Apps That Perform
Delivering Mobile Apps That Perform
 
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
 
AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2
 
2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 

Mais de Talentica Software

Android Media Player Development
Android Media Player DevelopmentAndroid Media Player Development
Android Media Player Development
Talentica Software
 

Mais de Talentica Software (20)

Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
 
Web 3.0
Web 3.0Web 3.0
Web 3.0
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
Nodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternNodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design Pattern
 
Node js Chapter-2
Node js Chapter-2Node js Chapter-2
Node js Chapter-2
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
 
Test Policy and Practices
Test Policy and PracticesTest Policy and Practices
Test Policy and Practices
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | Talentica
 
Connected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discoveryConnected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discovery
 
Mobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging TrendsMobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging Trends
 
Android Media Player Development
Android Media Player DevelopmentAndroid Media Player Development
Android Media Player Development
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile Technologies
 
Big Data Technologies - Hadoop
Big Data Technologies - HadoopBig Data Technologies - Hadoop
Big Data Technologies - Hadoop
 
Big Data – Are You Ready?
Big Data – Are You Ready?Big Data – Are You Ready?
Big Data – Are You Ready?
 
Legacy modernization
Legacy modernizationLegacy modernization
Legacy modernization
 
Continous Integration: A Case Study
Continous Integration: A Case StudyContinous Integration: A Case Study
Continous Integration: A Case Study
 
Technology Challenges in Building New Media Applications
Technology Challenges in Building New Media ApplicationsTechnology Challenges in Building New Media Applications
Technology Challenges in Building New Media Applications
 
Flex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application DevelopmentFlex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application Development
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Remix

  • 1. Remix By Rahul Mohan and Mohammed Farhan
  • 2. Speakers • Rahul Mohan, Talentica Software • Mohammed Farhan, Talentica Software 2
  • 3. Some Prerequisite • ReactJS • What is SSR, CSR, SSG. • SSR (Server-side rendering) : The good old days of PHP and templating languages. • SSR is faster but can be more costly in terms of deployment (thin client) can’t be cached in end nodes (CDN’s) • Pros of SSR: • Social media-friendly. • SEO friendly. • Fast First Concertful Paint (FCP). • Up-to-date content. 3
  • 4. SSR,CSR,SSG Cons: • Slow TTFB • Server-intensive workloads • Can’t be cached by traditional CDNs • Navigating across a site is slow without universal rendering • TTI is longer than FTP with universal rendering 4
  • 5. SSR,CSR,SSG • SSR (Static side Rendering) • Build the pages at run time, this was what the original web was made on, but new frameworks have made this a good alternative. • Pros of SSG: • Fast load times • SEO friendly • Cons of SSG: • Problematic for sites with many pages • No personalization • Content may be stale 5
  • 6. SSR,CSR,SSG • Cons of SSG: • Problematic for sites with many pages • No personalization • Content may be stale 6
  • 7. SSR,CSR,SSG • Client-Side Rendering This everyone is known as react become very prevalent in the last five years. • Pros: • Very responsive sites • No need to wait for pages to be loaded • Easy in a production env lower build times with the code- base as static page assets don’t need to be built. 7
  • 8. SSR,CSR,SSG • Cons • Hard to make is SEO Friendly (Google new ranking algorithm) • Bigger bundle sizes and slow first conceitful page. • Not he best option for very thin client there is a JS overhead. 8
  • 9. Why Remix ? • A Runtime for React • Component + API Route (write your server-side code and components in the same file). • Cut down the API overheads of any fetch. • Avoid the standard Pattern: • <form method=“post” onSubmit={event => { event.preventDefault(); }} • Create state to manage data. • Use effect hook to update UI. 9
  • 10. Why Remix ? • Use the form (browser) like the good old days of PHP let the browser manage the state. • useLoaderData,useActionData,useTransition • Amazing error bounders on the sever side code and the frontend side. 10
  • 12. Prerequisites-The dev setup 12 • Node.js 14 or greater(Preferred 16) • npm 7 or greater
  • 13. Initial setup • npx create-remix@latest • Follow along with the defaults use some other service if you want to have another server. (remix app serer should do fine for now) • cd project_name 13
  • 16. The file Structure 16 • app/ - This is where all your Remix app code goes • app/entry.client.tsx - This is the first bit of your JavaScript that will run when the app loads in the browser. We use this file to hydrate our React components. • app/entry.server.tsx - This is the first bit of your JavaScript that will run when a request hits your server. Remix handles loading all the necessary data and you're responsible for sending back the response. We'll use this file to render our React app to a string/stream and send that as our response to the client. • app/root.tsx - This is where we put the root component for our application. You render the <html> element here. • app/routes/ - This is where all your "route modules" will go. Remix uses the files in this directory to create the URL routes for your app based on the name of the files. • public/ - This is where your static assets go (images/fonts/etc) • remix.config.js - Remix has a handful of configuration options you can set in this file.
  • 17. The file Structure 17 • Let’s delete the files and start a new project
  • 18. The file Structure 18 • Change your root
  • 19. Routes • / • /blog • /blog/:blogID • /blog/new • /login 19
  • 20. Old way of routes 20
  • 27. Style and all that jazz • We are going back to the good old days of stylesheets 27
  • 28. Style and all that jazz 28
  • 29. Style and all that jazz 29
  • 30. Some Boring but important DB setup 30 • As this has nothing to do with react in general, I will be breezing through most of it, but you can use any ORM you please and use any underlying DB or API you please • We will be using Prisma • And a local DB
  • 31. LoaderFunction,useLoaderData,Link • LoaderFunction: This is simply an async function you export that returns a response • useLoaderData: The hook that replaces all the other use hooks on your fronted • Link: Similar to the one we all know and love from react-router. 31
  • 32. AUTHENTICATION - Process of recognizing a user's identity  Password based authentication  In web world HTTP cookies is the way to use for authentication.  HTTP Cookies – Server sends small piece of data to user’ browser and it stores it and sends back to server with later request for user specific authentication.  How to set cookie ?  Set-Cookie: <cookie-name>=<cookie-value> 32
  • 33. 33
  • 34. Remix‘s Session  Allow server to identify if request coming form same person  Remix comes with pre-built session storage options. 1. CreateCookieSessionStorage 2. createMemorySessionStorage 3. CreateFileSessionStorage 4. CreateCloudflareKVSessionStorage(cloudflare-workers) 5. CreateSessionStorage(Custom) 34
  • 35. How to create cookie session with Remix ? 35
  • 36. Error handling  Error handling in remix is stellar  Route modules has Error Boundary component exported and used  Error Boundary also works on server errors, action and loaders.  Error Boundary is some kind of same that we have in REACT16 36 export function ErrorBoundary() { }
  • 37. Unexpected Error handling Error those are not known or guessed it could be catch with this
  • 38. Expected Error handling Error those are known and based on that dev can display information to user
  • 39. SEO With Meta tags  Remix has meta export for route modules  <Meta/> Tag for app/root.tsx . It’s in built.
  • 40. Resource Routing  Renders other than HTML document like CSV data, image, RSS feed.  Crete a file under routes jokes[.]rss.tsx
  • 41. Remix can work without loading JavaScript to the page ?