SlideShare ist ein Scribd-Unternehmen logo
1 von 26
From AngularJS to React.
A journey of moving the TransferWise activities page to React.
A little bit of history
● Transferwise started as a big Grails app
The frontend was written inside gsp files. 😱
● When I joined we moved the frontend to AngularJS
That was 2016 and everyone was using AngularJS. 🤔
● Cue 3 years later...
It’s 2019. No one uses AngularJS. No one wants to work on it. 😳
2/25
Why React? Why not X.
● Things happened organically.
Apps start appearing next our main AngularJS app. It was only natural.
● Framework design patterns.
While AngularJS design patterns was very good, these days React is
giving teams a lot more modern options.
● Tooling
With tools like React dev tools, frameworks like redux, hooks, NextJS etc
teams are way more productive than they used to be.
● AngularJS is not being actively developed
Current LTS version is 1.7. Not likely to see more versions or fundamental
updates coming anytime soon.
3/25
Let’s rewrite everything!
4/25
Avoid full blown rewrites.
We want to do this iteratively.
We need to maintain the existing functionality.
5/25
“The goal of refactoring is to modernize
a system while retaining and extending
the value of the legacy investment.”
https://en.wikipedia.org/wiki/Software_mode
rnization
6/25
The big paradox.
7
You are doing this because you want to get
your customers off the old codebase.
8/25
You want to work less on the old. You want
the productivity gains of the new.
9/25
You can’t yet.
10/25
An example of a big Angular app
11/25
The big refactoring
● Old codebase maintenance
The reality is that most codebases that need replatforming have a fair bit of entropy
in them. So you need one last big refactor.
● Upgrade AngularJS version
Upgrade to at least version 1.5 onwards that introduces Components. Ideally you will
go to 1.7*
● Get rid of old Angular patterns
Things like Directives should be replaced by components.
● Two way data bindings are evil
All your bindings in the components have to be one way data binds. That way you
make sure you are compatible with modern frameworks logic
12/25
More refactoring!!
● TESTS!!!!
You might think you have enough tests. You don’t! Focus mostly on unit
tests. Cover all the functionality if you can. Without them you will
introduce new bugs and you will lose existing functionality.
● Split down the app.
If it's too big start extracting the individual sub-apps, move them to their
own repositories and host them in a private npm, or just Github
packages.
● Create a package for your app
Whether you decide to go with npm or Github it doesn’t matter. Create a
package from your app that you can consume.
13/25
Learnings on copying code
● Code that tightly couples the apps.
In the case of the Activity page we had a bunch of modules reused across
all our apps.
● Violating DRY.
We decided to violate DRY, copy the code to our new extracted app and
move on. That made things more complicated.
● Extract and reuse.
If I were to do this again I wouldn’t copy the code. I would have spent the
time extract it and reuse it. It feels like it slows you down but it doesn’t.
● Legacy Angular Modules
We ended up doing the above. Legacy angular modules repo was born.
14/25
Final stretch
● Making the original big app a skeleton.
Ideally you want to be in a place where your original app is a simple
skeleton that consumes packages you’ve extracted.
● Getting rid of things like Grunt/Gulp.
Gulp/Grunt were awesome. They moved us forward. We chose to remove
them so we can do tree shaking with webpack and use webpack-dev-
server for our demo page.
● Create a fully functional, mocked demo page
Using webpack dev-server create a demo page. This will multiply your
productivity. The target should be doing doing npm start will start a
operational page of your app.
15/25
Example of your webpack config.
16/25
First glimpses of hope.
17
We can now start rewriting! 😃
● Top-Bottom or Bottom-Up.
You can start rewriting components from the bottom or from the top.
The decision depends from where your complexity is. Start from the
simplest.
● We started from the top.
Most of our business logic wasn’t in the root. It was in the leaves of the
component tree.
● Rewrite the root.
What used to me your main controller now can be a React component.
You also need to decide where to keep your state.
18/25
Don't optimise for performance yet,
optimise for correctness.
19
Bringing it all together.
● Dropping the rest of the Angular application in the new base React
component.
Thankfully Boris Cherny, a Facebook developer wrote a super handy tool
called Angular2React
● Remember the tests?
This is the moment where the future you should thank past you. Make
sure all the existing tests are passing. When done you know you didn’t
lose any functionality during the move.
● Making sure the demo page still works.
Keep the demo page operational. It’s a key element to verify that our app
is still functional.
20/25
Gotchas
● You can implement SSR now.
You won’t be able to SSR a lot at this point.
● Careful of the window!
AngularJS depends on the presence of the window. It attaches there all
the global scope. When using NextJS this doesn’t exist. Use next/dynamic
to dynamically load your AngularJS parts.
● Angular2React + React2Angular
We had trouble when in the middle of our component tree we had a
React component wrapped with React2Angular. Things didn’t work.
21/25
Server Side Rendering
● This is totally optional but it has huge benefits
Server side rendering can massively improve your experience. For us we
SSR the main page, the navigation elements and a shimer loading effect.
The UX was greatly improved
● It totally has drawbacks too.
While there are a lot of benefits it also makes things more complicated.
AngularJS requires hacks to render.
● Using NextJS and CRAB.
As a frontend guild we decided to SSR our apps using NextJS. We also use
a NodeJS backend middleware to provide our app with TransferWise
related configs and tools. The new Activity page uses that.
22/25
Releasing.
● This is emotional.
The above is a big undertaking. You now have a React app. It's big, it's
bloated, it has at least 2 frameworks in it but you have started an iterative
process.
● Dockerize it!
● Deploy!
23/25
DONE!
24/25
Or is it?
25/25
26

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

An Introduction to Gutenberg, WordPress's New Editor
An Introduction to Gutenberg, WordPress's New EditorAn Introduction to Gutenberg, WordPress's New Editor
An Introduction to Gutenberg, WordPress's New Editor
 
How to push a react js application in production and sleep better
How to push a react js application in production and sleep betterHow to push a react js application in production and sleep better
How to push a react js application in production and sleep better
 
Git - Do's and Dont's for Good Development practice - Part 1
Git - Do's and Dont's for Good Development practice - Part 1Git - Do's and Dont's for Good Development practice - Part 1
Git - Do's and Dont's for Good Development practice - Part 1
 
Google Web Toolkit (GWT)
Google Web Toolkit (GWT)Google Web Toolkit (GWT)
Google Web Toolkit (GWT)
 
GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)
 
Continuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetupContinuous delivery@LesFurets - DC Continuous delivery meetup
Continuous delivery@LesFurets - DC Continuous delivery meetup
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
React Native.pptx (2)
React Native.pptx (2)React Native.pptx (2)
React Native.pptx (2)
 
Automating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with GulpAutomating WordPress Plugin Development with Gulp
Automating WordPress Plugin Development with Gulp
 
From a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscriptenFrom a native app to a webapp using Node.js and emscripten
From a native app to a webapp using Node.js and emscripten
 
Avoiding common pitfalls of datetime from a webapp's perspective
Avoiding common pitfalls of datetime from a webapp's perspectiveAvoiding common pitfalls of datetime from a webapp's perspective
Avoiding common pitfalls of datetime from a webapp's perspective
 
React Native
React NativeReact Native
React Native
 
What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017
 
Embracing the Change: How to Win with Gutenberg
Embracing the Change: How to Win with GutenbergEmbracing the Change: How to Win with Gutenberg
Embracing the Change: How to Win with Gutenberg
 
Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017
 
Annotation processing
Annotation processingAnnotation processing
Annotation processing
 
Migrating from angular to react
Migrating from angular to reactMigrating from angular to react
Migrating from angular to react
 
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
Shifting landscape of mobile automation, and the future of Appium - Jonathan ...
 
reactNative_Android
reactNative_AndroidreactNative_Android
reactNative_Android
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
 

Ähnlich wie AngularJS to React

Angular vs react.pdf
Angular vs react.pdfAngular vs react.pdf
Angular vs react.pdf
Decoro Software Solutions
 

Ähnlich wie AngularJS to React (20)

Getting Started to take an architectural decision in AngularJs.
Getting Started to take an architectural decision in AngularJs.Getting Started to take an architectural decision in AngularJs.
Getting Started to take an architectural decision in AngularJs.
 
Angular vs react comparison in 2022 which is better and why
Angular vs react comparison in 2022 which is better and whyAngular vs react comparison in 2022 which is better and why
Angular vs react comparison in 2022 which is better and why
 
Bulletproof design systems using storybook
Bulletproof design systems using storybookBulletproof design systems using storybook
Bulletproof design systems using storybook
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
What’s New in Angular 15.pptx
What’s New in Angular 15.pptxWhat’s New in Angular 15.pptx
What’s New in Angular 15.pptx
 
Angular vs react.pdf
Angular vs react.pdfAngular vs react.pdf
Angular vs react.pdf
 
Which technology has a better future_ AngularJS or ReactJS_.pdf
Which technology has a better future_ AngularJS or ReactJS_.pdfWhich technology has a better future_ AngularJS or ReactJS_.pdf
Which technology has a better future_ AngularJS or ReactJS_.pdf
 
What’s New in Angular 14?
What’s New in Angular 14?What’s New in Angular 14?
What’s New in Angular 14?
 
When It Comes Down To Choosing Between Angular OR React Framework For Your Ap...
When It Comes Down To Choosing Between Angular OR React Framework For Your Ap...When It Comes Down To Choosing Between Angular OR React Framework For Your Ap...
When It Comes Down To Choosing Between Angular OR React Framework For Your Ap...
 
What is Angular Ivy?
What is Angular Ivy?What is Angular Ivy?
What is Angular Ivy?
 
Angular Js Advantages - Complete Reference
Angular Js Advantages - Complete ReferenceAngular Js Advantages - Complete Reference
Angular Js Advantages - Complete Reference
 
_Angular Latest Version of 2022 With Features and Installation Guide.pdf
_Angular Latest Version of 2022 With Features and Installation Guide.pdf_Angular Latest Version of 2022 With Features and Installation Guide.pdf
_Angular Latest Version of 2022 With Features and Installation Guide.pdf
 
Web components and Package managers
Web components and Package managersWeb components and Package managers
Web components and Package managers
 
Where and Why Use Angular for Web Development?
Where and Why Use Angular for Web Development?Where and Why Use Angular for Web Development?
Where and Why Use Angular for Web Development?
 
Angular 6 - The Complete Guide
Angular 6 - The Complete GuideAngular 6 - The Complete Guide
Angular 6 - The Complete Guide
 
Angular.js vs. vue.js – which one is the better choice in 2022
Angular.js vs. vue.js – which one is the better choice in 2022 Angular.js vs. vue.js – which one is the better choice in 2022
Angular.js vs. vue.js – which one is the better choice in 2022
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Web worker in your angular application
Web worker in your angular applicationWeb worker in your angular application
Web worker in your angular application
 
Angular vs react
Angular vs reactAngular vs react
Angular vs react
 
Effects, Coeffects & Subscriptions: a pit of success for SPAs
Effects, Coeffects & Subscriptions: a pit of success for SPAsEffects, Coeffects & Subscriptions: a pit of success for SPAs
Effects, Coeffects & Subscriptions: a pit of success for SPAs
 

Kürzlich hochgeladen

%+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 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 Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Kürzlich hochgeladen (20)

%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+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...
 
%+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...
 
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
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
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
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
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
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

AngularJS to React

  • 1. From AngularJS to React. A journey of moving the TransferWise activities page to React.
  • 2. A little bit of history ● Transferwise started as a big Grails app The frontend was written inside gsp files. 😱 ● When I joined we moved the frontend to AngularJS That was 2016 and everyone was using AngularJS. 🤔 ● Cue 3 years later... It’s 2019. No one uses AngularJS. No one wants to work on it. 😳 2/25
  • 3. Why React? Why not X. ● Things happened organically. Apps start appearing next our main AngularJS app. It was only natural. ● Framework design patterns. While AngularJS design patterns was very good, these days React is giving teams a lot more modern options. ● Tooling With tools like React dev tools, frameworks like redux, hooks, NextJS etc teams are way more productive than they used to be. ● AngularJS is not being actively developed Current LTS version is 1.7. Not likely to see more versions or fundamental updates coming anytime soon. 3/25
  • 5. Avoid full blown rewrites. We want to do this iteratively. We need to maintain the existing functionality. 5/25
  • 6. “The goal of refactoring is to modernize a system while retaining and extending the value of the legacy investment.” https://en.wikipedia.org/wiki/Software_mode rnization 6/25
  • 8. You are doing this because you want to get your customers off the old codebase. 8/25
  • 9. You want to work less on the old. You want the productivity gains of the new. 9/25
  • 11. An example of a big Angular app 11/25
  • 12. The big refactoring ● Old codebase maintenance The reality is that most codebases that need replatforming have a fair bit of entropy in them. So you need one last big refactor. ● Upgrade AngularJS version Upgrade to at least version 1.5 onwards that introduces Components. Ideally you will go to 1.7* ● Get rid of old Angular patterns Things like Directives should be replaced by components. ● Two way data bindings are evil All your bindings in the components have to be one way data binds. That way you make sure you are compatible with modern frameworks logic 12/25
  • 13. More refactoring!! ● TESTS!!!! You might think you have enough tests. You don’t! Focus mostly on unit tests. Cover all the functionality if you can. Without them you will introduce new bugs and you will lose existing functionality. ● Split down the app. If it's too big start extracting the individual sub-apps, move them to their own repositories and host them in a private npm, or just Github packages. ● Create a package for your app Whether you decide to go with npm or Github it doesn’t matter. Create a package from your app that you can consume. 13/25
  • 14. Learnings on copying code ● Code that tightly couples the apps. In the case of the Activity page we had a bunch of modules reused across all our apps. ● Violating DRY. We decided to violate DRY, copy the code to our new extracted app and move on. That made things more complicated. ● Extract and reuse. If I were to do this again I wouldn’t copy the code. I would have spent the time extract it and reuse it. It feels like it slows you down but it doesn’t. ● Legacy Angular Modules We ended up doing the above. Legacy angular modules repo was born. 14/25
  • 15. Final stretch ● Making the original big app a skeleton. Ideally you want to be in a place where your original app is a simple skeleton that consumes packages you’ve extracted. ● Getting rid of things like Grunt/Gulp. Gulp/Grunt were awesome. They moved us forward. We chose to remove them so we can do tree shaking with webpack and use webpack-dev- server for our demo page. ● Create a fully functional, mocked demo page Using webpack dev-server create a demo page. This will multiply your productivity. The target should be doing doing npm start will start a operational page of your app. 15/25
  • 16. Example of your webpack config. 16/25
  • 17. First glimpses of hope. 17
  • 18. We can now start rewriting! 😃 ● Top-Bottom or Bottom-Up. You can start rewriting components from the bottom or from the top. The decision depends from where your complexity is. Start from the simplest. ● We started from the top. Most of our business logic wasn’t in the root. It was in the leaves of the component tree. ● Rewrite the root. What used to me your main controller now can be a React component. You also need to decide where to keep your state. 18/25
  • 19. Don't optimise for performance yet, optimise for correctness. 19
  • 20. Bringing it all together. ● Dropping the rest of the Angular application in the new base React component. Thankfully Boris Cherny, a Facebook developer wrote a super handy tool called Angular2React ● Remember the tests? This is the moment where the future you should thank past you. Make sure all the existing tests are passing. When done you know you didn’t lose any functionality during the move. ● Making sure the demo page still works. Keep the demo page operational. It’s a key element to verify that our app is still functional. 20/25
  • 21. Gotchas ● You can implement SSR now. You won’t be able to SSR a lot at this point. ● Careful of the window! AngularJS depends on the presence of the window. It attaches there all the global scope. When using NextJS this doesn’t exist. Use next/dynamic to dynamically load your AngularJS parts. ● Angular2React + React2Angular We had trouble when in the middle of our component tree we had a React component wrapped with React2Angular. Things didn’t work. 21/25
  • 22. Server Side Rendering ● This is totally optional but it has huge benefits Server side rendering can massively improve your experience. For us we SSR the main page, the navigation elements and a shimer loading effect. The UX was greatly improved ● It totally has drawbacks too. While there are a lot of benefits it also makes things more complicated. AngularJS requires hacks to render. ● Using NextJS and CRAB. As a frontend guild we decided to SSR our apps using NextJS. We also use a NodeJS backend middleware to provide our app with TransferWise related configs and tools. The new Activity page uses that. 22/25
  • 23. Releasing. ● This is emotional. The above is a big undertaking. You now have a React app. It's big, it's bloated, it has at least 2 frameworks in it but you have started an iterative process. ● Dockerize it! ● Deploy! 23/25
  • 26. 26

Hinweis der Redaktion

  1. Talk here about things like: Hiring top talent is difficult on an old framework Updates on the framework are limited Deep knowledge of the frameworks in and outs are limited in candidates (even you hire them) Tooling is sub-par by comparison with React. Developer productivity is suffering.
  2. Talk here about things like: Transferwise autonomous teams and what that means in decisions The role of the frontend guild in coordinating these decisions Talent
  3. Well, not so fast. Unless your AngularJS app is one small page or almost a static website then it's not a good idea. There will be dragons. Think of the user. While you rewrite to the new framework you will stop adding features and supporting your old codebase. That's a big negative. It can't be happening for too long. You need to make sure you maintain all the existing functionality. Don't introduce new bugs.
  4. Regarding the update to 1.7. You don’t need to do that if you plan to do the replatform fast. 1.5 should be sufficient. The benefit of moving to 1.7 is the LTS from Angular and the security updates you’ll get. Regarding the move to components. You can make directives work but Angular2React requires components: https://github.com/coatue-oss/angular2react
  5. Regarding tests: Mention that we chose to move away from Karma and Jasmine to Jest and Enzyme. We did it for future reuse in React. Seriously. If you don’t write more tests the entire thing will not be as robust as you’d like to.
  6. Mention here that Legacy Angular Module is an npm package that all Angular apps can use Mention why it was bad. Because changes were happening to 2 different code bases and we ended up missing features in both. It was terrible.
  7. Mention: Your sub-apps should be visible in your package.json
  8. Here give an example of TransferWise Activity page. Our complexity is in the leafs of the component tree. Regarding state, talk about different options like prop drilling, redux or hooks. Whatever you choose you can change it later.
  9. Speak
  10. About Angular2React: This tool will take one Angular component and it will turn it to React component. The caveat is that it only deals with one way data bindings (`<`). So now the refactoring we did in section one pays dividends. It's super easy to wrap your Angular components and drop them in React. If you chose to go Bottom-Up there is react2angular too. Does the opposite thing. About the tests: Mention that to make the tests pass you should simply change all the Angular specific things to React. Using Enzyme and Jest helps. Make sure you don’t delete any tests. You need all the discipline of the world at this point.
  11. For SSR AngularJS: Mention the window object where Angular attaches itself. Also mention the window.config that TransferWise used to save configuration elements for the different components.
  12. Regarding the window: Mention that you need to be generally defensive in your code. You need to add checks whether window is available or not in certain cases. Mention an example from TW where we saved config to window.
  13. * If you reach this point you did it! You have an app in production. A hybrid. Your next steps are now to keep unappealing the onion further. * Take the next component, rewrite that in React, wrap its children with Angular2React * Move tests * Release * Repeat.