How it works...

You can start the application by running the npm start command.

If you open the app at http://localhost:3000 in your browser (Chrome, for example) and you right-click and then View page source, you will probably notice that we are not using SSR:

This is because we will only use SSR for search bots. The isBot function will detect all the search bots, and just for a test I added curl as a bot to test our SSR; this is the code of that function:

  export function isBot(ua) {    const b = /curl|bot|googlebot|google|baidu|bing|msn|duckduckgo|teoma|slurp|yandex|crawler|spider|robot|crawling/i;    return b.test(ua);  }
File: src/shared/utils/device.js ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.