Playbook · Migrations

Updated

How long does an AngularJS to React migration take?

Estimate an AngularJS to React migration the same way as one to Angular: lines of code divided by lines your team writes per week, plus 40% for learning. A 100,000-line app at 1,000 lines a week is about 140 weeks.

Time to migrate = (lines of code / lines written per week) x 1.4. A 100,000-line app at 1,000 lines a week takes 140 weeks, about 2.7 years. The author says the same math works for React or Vue.
Source: XLTS.dev, 16 Jan 2021, updated 5 Mar 2024

The big difference from going to Angular

Angular gives AngularJS apps an official bridge, UpgradeModule, that runs both frameworks in one app. React has no official equivalent. You build the bridge yourself: an AngularJS directive that mounts a React root into its element with createRoot and unmounts it when the scope is destroyed. React’s docs describe this way of adding React to part of an existing page, and say it is how most React at Meta was used for years.

It works. It is also your code now, with nobody upstream to send a bug report to, so it needs tests like any other code.

Why teams pick React over Angular here

Both are full rewrites of every template. The choice usually comes down to who you can hire and what the rest of your company already runs. If another team ships React, sharing a design system and people is worth more than any framework feature.

What breaks in an AngularJS to React migration

  • Shared state on $rootScope or in services. React needs it lifted into a store or context that both sides can read during the hybrid period.
  • Routing. Two routers fighting over the URL is the most common hybrid bug, and the back button is where it shows. Pick one owner early.
  • Filters and directives used inside templates. Each becomes a component or a function.
  • Digest timing. AngularJS will not see changes React makes unless the bridge tells it to. Until then the screen shows old data with full confidence.

Steps for an AngularJS to React migration

  • Delete dead code, then count the lines that are left and run the formula above. Deleting is the cheapest migration there is.
  • Write the bridge: one AngularJS directive that mounts a React component with createRoot and unmounts it on $destroy. Test it before anything uses it.
  • Move shared state out of $rootScope into a store both sides can read.
  • Port leaf components first and drop them into the old screens through the bridge.
  • Decide which router owns the URL, then move whole routes to React one at a time.
  • Remove AngularJS when the last route has moved.

What drives the cost

The only published price range I found is for AngularJS to Angular ($10,000 to $40,000 for a small SaaS, The Frontend Company). I found nothing comparable with React as the target, so treat that as a rough reference and use the formula above on your own line count.

A support date to keep in mind

AngularJS long-term support ended on 31 December 2021. If the app handles logins or payments, the real risk is that nobody ships security fixes for it any more.

Read next

Sources

Start

Tell me where the product is stuck.

In 30 minutes we look at where things stand, what you need from a CTO right now, and which option fits. Either way, you leave with a clear next step.

How the call goes

  1. 01You tell me about the product, the team and the next 6 months.
  2. 02I ask about the code, the stack and what keeps breaking.
  3. 03We pick the option that fits, or agree that none does.

09:00 to 20:00 CET

Founding rate: the first 3 clients get 20% off, in return for a named testimonial and a case study. On a monthly plan, the 20% applies to the first month.