I try to add ReactJS in my custom theme but I don’t have any idea to How to integrate ReactJS with Magento 2 frontend.
I want to make Magento 2 frontend using react js instead of knockout js.
Does anyone have idea?
Where can I start and how it’s possible ?
2
Answers
In general, you can use graphQL API (with Apollo client).
SSR (Server Side Rendering) should be used for SEO reasons. For simplicity (and speed) you can use Gatsby and treat Magento as headless CMS. I found a tutorial for that a few days ago.
Cart/order processing can be done using standard templates (for simplicity).
For React JS integration With Magento 2 yo need special approach. This module shows how integrate Magento 2 with WebPack for React and JSX compilation. This module provides this opportunity and automatically deploys and overloads magneto page if you bundle js file has changes (live reload) – https://github.com/Genaker/reactmagento2