Reaction Commerce Forums

Using React based components in plugins



As far as I understand, RC is in the process of moving away from Blaze to React. Given that, is it currently possible to use React based components in custom plugins and how does this play with the rest of the Blaze based layouts. It would be super helpful if you could point me towards an example of this.



You can use React inside a Blaze component, and everything will play nice.

As for some examples:

The Icon component is a React component, and we have an example in out docs of how to use it with a Blaze wrapper component. Example under "Example (Client) (Blaze)"

Just apply that style to any react component.

You can also do something like following:

In the Blaze template.js file, you can define all the props for the react component

Then in the Blaze template.html you can just display it with the helper

Final note

All React components in Blaze templates need to be wrapped in an HTML element, and be the only thing inside. Otherwise you’ll get critical errors.


thanks @mike! this is great


Hi @mike, I tried to use React template in Blaze component, but got error that ‘component’ element is missing. I tried to find example you mentioned (Example (Client) (Blaze)), but I couldn’t. Can you please let me know where it is?
I’m new to RC, so maybe it’s simple, but I couldn’t make it work.