I have a requirement in my project. It is an existing project which is developed in Dotnet MVC + Sitecore 9.1, so some part of the page in that project needs to be implemented in react js, for example, calling the service and filtering the data. My question is how we can integrate the react js with this existing project that has MVC + Sitecore 9.1 ? Is there any way to do all this things? Thanks in advance.
Yes - Sitecore JSS / Headless Services
Client Side Embedding
Client Side Embedding is a simple approach for client-side only rendering of ReactJS components, especially if not aiming to have ReactJS drive the page layout.
There is also a community supported extension of ReactJS.NET which is Sitecore.React. However the following considerations should be taken into account when deciding which direction to go:
- JSS is officially supported and maintained for Sitecore 9.1+
- ReactJS.NET and Sitecore.React are not officially supported by Sitecore
- JSS supports the Experience Editor, Sitecore.React also supports the Experience Editor, but does require you to call
FieldRenderer.Render(item, "field")in the controller.
- JSS supports the Tracker (for Analytics, Personalisation and Optimization),
- Sitecore.React also supports the Tracker with no extra code.
- JSS is more scalable as it has headless support, whereas the community modules above are coupled to .NET MVC.
- JSS has support for Sitecore Experience Accelerator in Sitecore 9.2+
- JSS requires your Sitecore license has this enabled - you will need to check your license details or contact your account manager to confirm.
- Sitecore.React does not require any extra licenses
- Sitecore.React does not have a dependency on node.js.
3Just to clarify, with Sitecore.React, you don't need to write any extra code or effort for the Experience Editor, it supports this out of the box. Same with Tracker for analytics. Because it is just a controller rendering, it works just the same. You can personalize, a/b test etc... everything that you can do with a controller rendering... :)– Richard Seal ♦Jul 12, 2019 at 14:38
Agreed with @Richard Seal about number of JSS component per page for performance Dec 5, 2019 at 18:29