vendredi 15 mai 2020

Migrating From Ember to React Page by Page Exploring Options

I want to move a big Ember v1.4.0 app to React. Instead of creating a new UI from scratch. I want to start building it in React my converting pages over slowly, essentially mixing React and Ember pages in one website.

Goal: The above is my ultimate goal, but my first goal is is to create a single page in React that is called by Ember's router.

What I have tried so far: I wanted to create a React component in a ./templates/myFirstTestPage.handlebars because, as I understand it, the router.js calls a template file. But I am unsuccessful creating a React component in the handlebars file. Firstly, I cannot use to import React because does not work in handlebars. Secondly, I believe the handlebars is parsing the React app in an incorrect way. Actually, I don't really understand how, and in what order, these frameworks do the rendering.

Possible solutions (but I need implementation details):

  1. Somehow create a React component in the template folder with the .handlebars extension.

  2. Refer to the url of a React app in the handlebars of an Ember app

  3. Have the Ember router map the url to a jsx file. This solution seems really viable to me. I think to myself that surely the creators of Ember must have thought that people might want to have their Ember app refer to some regular html file. Hence, I hope someone might have some knowledge whether this is possible or not.

  4. Somehow create my own router that maps urls to particular files. If its a React component, then I'd map it to my jsx file, if not, I let Ember's router take care of the mapping. I don't really know how to implement a url mapping thing though.




Aucun commentaire:

Enregistrer un commentaire