React Theme Components

A bit of an odd question, but has anyone tried creating a theme component using React? I’ve seen a couple of sources that make React work with Ember, but I’m not sure if they could be applied within the context of a theme component.
eg:

https://github.com/alexlafroscia/ember-react-components

Use case:
Client has a fancy brand header written in React which is used across all their web properties. This bar features their hero products, and changes regularly, so it would be nice to be able to move it out to its own repository, and have a single place to update it, rather than having to maintain it in Ember, React etc.

2 Likes

From the link:

It does work, but you should be really careful about including both the Ember and React libraries in your application since that’s quite a lot of JavaScript to ship to your users

You gotta carefully evaluate if increasing the load time of the forum so much is really worth it for you.

The more common route here, is that the header is written in anything, but compiled to HTML and every downstream project just imports the resulting HTML.

9 Likes

Thanks for being the voice of sanity :slight_smile:

Consuming the HTML is a much more reasonable approach. The only rub is that the header has Login/Register links that have to change depending on the user’s logged-in state…

Maybe the trick is to implement the core structure of the header, including the dynamic Login, in Ember, and pull in just the content area that changes often.

3 Likes