[ad_1]
React and different comparable libraries (like Vue.js) have gotten the de facto selection for bigger companies that require complicated improvement the place a extra simplistic method (like utilizing a WordPress theme) gained’t fulfill the necessities.
Regardless of that, SEOs didn’t initially embrace libraries like React as a result of search engines like google struggling to successfully render JavaScript, with content material accessible inside the HTML supply being the choice.
Nevertheless, developments in each how Google and React can render JavaScript have simplified these complexities, leading to Search engine marketing not being the blocker for utilizing React.
Nonetheless, some complexities stay, which I’ll run by way of in this information.
On that notice, right here’s what we’ll cowl:
React is an open-source JavaScript library developed by Meta (previously Fb) for constructing net and cell functions. The principle options of React are that it is declarative, is component-based, and permits simpler manipulation of the DOM.
The best solution to perceive the elements is by considering of them as plugins, like for WordPress. They permit builders to shortly construct a design and add performance to a web page utilizing element libraries like MUI or Tailwind UI.
If you need the complete lowdown on why builders love React, begin right here:
React implements an App Shell Mannequin, which means the overwhelming majority of content material, if not all, can be Consumer-side Rendered (CSR) by default.
CSR means the HTML primarily comprises the React JS library somewhat than the server sending all the web page’s contents inside the preliminary HTTP response from the server (the HTML supply).
It’s going to additionally embody miscellaneous JavaScript containing JSON knowledge or hyperlinks to JS information that comprise React elements. You possibly can shortly inform a website is client-side rendered by checking the HTML supply. To try this, right-click and choose “View Web page Supply” (or CTRL + U/CMD + U).
A screenshot of the netlfix.com homepage supply HTML.
In the event you don’t see many traces of HTML there, the appliance is probably going client-side rendering.
Nevertheless, whenever you examine the ingredient by right-clicking and choosing “Examine ingredient” (or F12/CMD + ⌥ + I), you’ll see the DOM generated by the browser (the place the browser has rendered JavaScript).
The result’s you’ll then see the location has quite a lot of HTML:

Notice the appMountPoint ID on the primary <div>. You’ll generally see a component like that on a single-page utility (SPA), so a library like React is aware of the place it ought to inject HTML. Know-how detection instruments, e.g., Wappalyzer, are additionally nice at detecting the library.
Editor’s Notice
Ahrefs’ Website Audit saves each the Uncooked HTML despatched from the server and the Rendered HTML within the browser, making it simpler to identify whether or not a website has client-side rendered content material.

Even higher, you possibly can search each the Uncooked and Rendered HTML to know what content material is particularly being rendered client-side. Within the under instance, you possibly can see this website is client-side rendering key web page content material, such because the <h1> tag.


Web sites created utilizing React differ from the extra conventional method of leaving the heavy-lifting of rendering content material on the server utilizing languages like PHP—referred to as Server-side Rendering (SSR).
The above exhibits the server rendering JavaScript into HTML with React (extra on that shortly). The idea is identical for websites constructed with PHP (like WordPress). It’s simply PHP being became HTML somewhat than JavaScript.
Earlier than SSR, builders stored it even less complicated.
They’d create static HTML paperwork that didn’t change, host them on a server, after which ship them instantly. The server didn’t have to render something, and the browser typically had little or no to render.
SPAs (together with these utilizing React) are actually coming full circle again to this static method. They’re now pre-rendering JavaScript into HTML earlier than a browser requests the URL. This method is named Static Website Technology (SSG), also called Static Rendering.

In observe, SSR and SSG are comparable.
The important thing distinction is that rendering occurs with SSR when a browser requests a URL versus a framework pre-rendering content material at construct time with SSG (when builders deploy new code or an internet admin modifications the location’s content material).
SSR will be extra dynamic however slower as a result of further latency whereas the server renders the content material earlier than sending it to the consumer’s browser.
SSG is quicker, because the content material has already been rendered, which means it may be served to the consumer instantly (which means a faster TTFB).
To grasp why React’s default client-side rendering method causes Search engine marketing points, you first have to know how Google crawls, processes, and indexes pages.
We will summarize the fundamentals of how this works in the under steps:
- Crawling – Googlebot sends GET requests to a server for the URLs within the crawl queue and saves the response contents. Googlebot does this for HTML, JS, CSS, picture information, and extra.
- Processing – This contains including URLs to the crawl queue discovered inside <a href> hyperlinks inside the HTML. It additionally contains queuing useful resource URLs (CSS/JS) discovered inside <hyperlink> tags or pictures inside <img src> tags. If Googlebot finds a noindex tag at this stage, the method stops, Googlebot gained’t render the content material, and Caffeine (Google’s indexer) gained’t index it.
- Rendering – Googlebot executes JavaScript code with a headless Chromium browser to seek out further content material inside the DOM, however not the HTML supply. It does this for all HTML URLs.
- Indexing – Caffeine takes the knowledge from Googlebot, normalizes it (fixes damaged HTML), after which tries to make sense of all of it, precomputing some rating indicators prepared for serving inside a search outcome.

Traditionally, points with React and different JS libraries have been as a result of Google not dealing with the rendering step effectively.
Some examples embody:
- Not rendering JavaScript – It’s an older situation, however Google solely began rendering JavaScript in a restricted approach in 2008. Nevertheless, it was nonetheless reliant on a crawling scheme for JavaScript websites created in 2009. (Google has since deprecated the scheme.)
- The rendering engine (Chromium) being outdated – This resulted in a lack of help for the most recent browser and JavaScript options. In the event you used a JavaScript function that Googlebot didn’t help, your web page would possibly not render accurately, which may negatively affect your content material’s indexing.
- Google had a rendering delay – In some circumstances, this might imply a delay of up to some weeks, slowing down the time for modifications to the content material to achieve the indexing stage. This may have dominated out counting on Google to render content material for many websites.
Fortunately, Google has now resolved most of those points. Googlebot is now evergreen, which means it at all times helps the most recent options of Chromium.
As well as, the rendering delay is now 5 seconds, as introduced by Martin Splitt on the Chrome Developer Summit in November 2019:
Final yr Tom Greenaway and I have been on this stage and telling you, ‘Properly, you understand, it may possibly take as much as per week, we’re very sorry for this.’ Overlook this, okay? As a result of the brand new numbers look loads higher. So we really went over the numbers and located that, it seems that at median, the time we spent between crawling and truly having rendered these outcomes is – on median – it’s 5 seconds!”
This all sounds constructive. However is client-side rendering and leaving Googlebot to render content material the appropriate technique?
The reply is probably nonetheless no.
Previously 5 years, Google has innovated its dealing with of JavaScript content material, however totally client-side rendered websites introduce different points that you could take into account.
It’s essential to notice that you possibly can overcome all points with React and Search engine marketing.
React JS is a improvement device. React is not any completely different from another device inside a improvement stack, whether or not that’s a WordPress plugin or the CDN you select. The way you configure it is going to determine whether or not it detracts or enhances Search engine marketing.
Finally, React is sweet for Search engine marketing, because it improves consumer expertise. You simply have to be sure you take into account the next widespread points.
1. Decide the appropriate rendering technique
Essentially the most important situation you’ll have to sort out with React is how it renders content material.
As talked about, Google is nice at rendering JavaScript these days. However sadly, that isn’t the case with different search engines like google. Bing has some help for JavaScript rendering, though its effectivity is unknown. Different search engines like google like Baidu, Yandex, and others supply restricted help.
Sidenote.
This limitation doesn’t solely affect search engines like google. Other than website auditors, Search engine marketing instruments that crawl the net and supply crucial knowledge on components like a website’s backlinks don’t render JavaScript. This will have a important affect on the standard of knowledge they supply. The one exception is Ahrefs, which has been rendering JavaScript throughout the net since 2017 and at present renders over 200 million pages per day.
Introducing this unknown builds a superb case for choosing a server-side rendered resolution to make sure that all crawlers can see the location’s content material.
As well as, rendering content material on the server has one other essential profit: load occasions.
Load occasions
Rendering JavaScript is intensive on the CPU; this makes massive libraries like React slower to load and develop into interactive for customers. You’ll typically see Core Internet Vitals, similar to Time to Interactive (TTI), being a lot increased for SPAs—particularly on cell, the first approach customers eat net content material.
An instance React utility that makes use of client-side rendering.
Nevertheless, after the preliminary render by the browser, subsequent load occasions are usually faster as a result of following:
Relying on the variety of pages seen per go to, this can lead to subject knowledge being constructive total.

Nevertheless, in case your website has a low variety of pages seen per go to, you’ll wrestle to get constructive subject knowledge for all Core Internet Vitals.
Resolution
The best choice is to go for SSR or SSG primarily due to:
- Quicker preliminary renders.
- Not having to depend on search engine crawlers to render content material.
- Enhancements in TTI as a result of much less JavaScript code for the browser to parse and render earlier than changing into interactive.
Implementing SSR inside React is feasible through ReactDOMServer. Nevertheless, I like to recommend utilizing a React framework referred to as Subsequent.js and utilizing its SSG and SSR choices. You may as well implement CSR with Subsequent.js, however the framework nudges customers towards SSR/SSG as a result of velocity.
Subsequent.js helps what it calls “Computerized Static Optimization.” In observe, this implies you possibly can have some pages on a website that use SSR (similar to an account web page) and different pages utilizing SSG (similar to your weblog).
The outcome: SSG and quick TTFB for non-dynamic pages, and SSR as a backup rendering technique for dynamic content material.
Sidenote.
You could have heard about React Hydration with ReactDOM.hydrate(). That is the place content material is delivered through SSG/SSR after which turns right into a client-side rendered utility through the preliminary render. This can be the plain selection for dynamic functions sooner or later somewhat than SSR. Nevertheless, hydration at present works by loading all the React library after which attaching occasion handlers to HTML that may change. React then retains HTML between the browser and server in sync. At the moment, I can’t suggest this method as a result of it nonetheless has destructive implications for net vitals like TTI for the preliminary render. Partial Hydration might resolve this sooner or later by solely hydrating crucial components of the web page (like ones inside the browser viewport) somewhat than all the web page; till then, SSR/SSG is the higher possibility.
Since we’re speaking about velocity, I’ll be doing you a disservice by not mentioning different methods Subsequent.js optimizes the crucial rendering path for React functions with options like:
- Picture optimization – This provides width and peak <img> attributes and srcset, lazy loading, and picture resizing.
- Font optimization – This inlines crucial font CSS and provides controls for font-display.
- Script optimization – This allows you to decide when a script needs to be loaded: earlier than/after the web page is interactive or lazily.
- Dynamic imports – In the event you implement finest practices for code splitting, this function makes it simpler to import JS code when required somewhat than leaving it to load on the preliminary render and slowing it down.
Pace and constructive Core Internet Vitals are a rating issue, albeit a minor one. Subsequent.js options make it simpler to create nice net experiences that will provide you with a aggressive benefit.
TIP
Many builders deploy their Subsequent.js net functions utilizing Vercel (the creators of Subsequent.js), which has a worldwide edge community of servers; this leads to quick load occasions.
Vercel gives knowledge on the Core Internet Vitals of all websites deployed on the platform, however it’s also possible to get detailed net very important knowledge for every URL utilizing Ahrefs’ Website Audit.
Merely add an API key inside the crawl settings of your tasks.

After you’ve run your audit, take a look on the efficiency space. There, Ahrefs’ Website Audit will present you charts displaying knowledge from the Chrome Person Expertise Report (CrUX) and Lighthouse.

2. Use standing codes accurately
A typical situation with most SPAs is that they don’t accurately report standing codes. That is because the server isn’t loading the web page—the browser is. You’ll generally see points with:
- No 3xx redirects, with JavaScript redirects getting used as a substitute.
- 4xx standing codes not reporting for “not discovered” URLs.
You possibly can see under I ran a take a look at on a React website with httpstatus.io. This web page ought to clearly be a 404 however, as a substitute, returns a 200 standing code. That is referred to as a tender 404.

The chance right here is that Google might determine to index that web page (relying on its content material). Google may then serve this to customers, or it’ll be used when evaluating a website.
As well as, reporting 404s helps SEOs audit a website. In the event you by accident internally hyperlink to a 404 web page and it’s returning a 200 standing code, shortly recognizing the realm with an auditing device might develop into rather more difficult.
There are a few methods to resolve this situation. In the event you’re client-side rendering:
- Use the React Router framework.
- Create a 404 element that exhibits when a route isn’t acknowledged.
- Add a noindex tag to “not discovered” pages.
- Add a <h1> with a message like “404: Web page Not Discovered.” This isn’t perfect, as we don’t report a 404 standing code. However it is going to forestall Google from indexing the web page and assist it acknowledge the web page as a tender 404.
- Use JavaScript redirects when you could change a URL. Once more, not perfect, however Google does observe JavaScript redirects and cross rating indicators.
In the event you’re utilizing SSR, Subsequent.js makes this straightforward with response helpers, which allow you to set no matter standing code you need, together with 3xx redirects or a 4xx standing code. The method I outlined utilizing React Router may also be put into observe whereas utilizing Subsequent.js. Nevertheless, if you’re utilizing Subsequent.js, you’re probably additionally implementing SSR/SSG.
3. Keep away from hashed URLs
This situation isn’t as widespread for React, but it surely’s important to keep away from hash URLs like the next:
- https://reactspa.com/#/store
- https://reactspa.com/#/about
- https://reactspa.com/#/contact
Usually, Google isn’t going to see something after the hash. All of those pages can be seen as https://reactspa.com/.
Resolution
SPAs with client-side routing ought to implement the Historical past API to vary pages.
You are able to do this comparatively simply with each React Router and Subsequent.js.
4. Use <a href> hyperlinks the place related
A typical mistake with SPAs is utilizing a <div> or a <button> to vary the URL. This isn’t a difficulty with React itself, however how the library is used.
Doing this presents a difficulty with search engines like google. As talked about earlier, when Google processes a URL, it appears for added URLs to crawl inside <a href> components.
If the <a href> ingredient is lacking, Google gained’t crawl the URLs and cross PageRank.
Resolution
The answer is to incorporate <a href> hyperlinks to URLs that you really want Google to find.
Checking whether or not you’re linking to a URL accurately is simple. Examine the ingredient that internally hyperlinks and verify the HTML to make sure you’ve included <a href> hyperlinks.
As within the above instance, you will have a difficulty in the event that they aren’t.
Nevertheless, it’s important to grasp that lacking <a href> hyperlinks aren’t at all times a difficulty. One advantage of CSR is that when content material is useful to customers however not search engines like google, you possibly can change the content material client-side and never embody the <a href> hyperlink.
Within the above instance, the location makes use of faceted navigation that hyperlinks to doubtlessly thousands and thousands of combos of filters that aren’t helpful for a search engine to crawl or index.

Loading these filters client-side is smart right here, as the location will preserve crawl finances by not including <a href> hyperlinks for Google to crawl.
Subsequent.js makes this simple with its hyperlink element, which you’ll be able to configure to permit client-side navigation.
In the event you’ve determined to implement a completely CSR utility, you possibly can change URLs with React Router utilizing onClick and the Historical past API.
5. Keep away from lazy loading important HTML
It’s widespread for websites developed with React to inject content material into the DOM when a consumer clicks or hovers over a component—just because the library makes that simple to do.
This isn’t inherently unhealthy, however content material added to the DOM this manner won’t be seen by search engines like google. If the content material injected contains essential textual content material or inside hyperlinks, this will likely negatively affect:
- How effectively the web page performs (as Google gained’t see the content material).
- The discoverability of different URLs (as Google gained’t discover the inner hyperlinks).
Right here’s an instance on a React JS website I just lately audited. Right here, I’ll present a widely known e‑commerce model with essential inside hyperlinks inside its faceted navigation.
Nevertheless, a modal displaying the navigation on cell was injected into the DOM whenever you clicked a “Filter” button. Watch the second <!—-> inside the HTML under to see this in observe:

Resolution
Recognizing these points isn’t simple. And so far as I do know, no device will instantly let you know about them.
As a substitute, you need to verify for widespread components such as:
- Accordions
- Modals
- Tabs
- Mega menus
- Hamburger menus
You’ll then want to examine the ingredient on them and watch what occurs with the HTML as you open/shut them by clicking or hovering (as I’ve finished within the above GIF).
Suppose you discover JavaScript is including HTML to the web page. In that case, you’ll have to work with the builders. That is so that somewhat than injecting the content material into the DOM, it’s included inside the HTML by default and is hidden and proven through CSS utilizing properties like visibility: hidden; or show: none;.
6. Don’t neglect the basics
Whereas there are further Search engine marketing issues with React functions, that doesn’t imply different fundamentals don’t apply.
You’ll nonetheless want to verify your React functions observe finest practices for:
Remaining ideas
Sadly, working with React functions does add to the already lengthy record of points a technical Search engine marketing must verify. However because of frameworks like Subsequent.js, it makes the work of an Search engine marketing rather more simple than what it was traditionally.
Hopefully, this information has helped you higher perceive the extra issues you could make as an Search engine marketing when working with React functions.
Have any questions on working with React? Tweet me.
[ad_2]
