React Native loading JSX from outside source and transforming it at run time


#1

I am kicking around an idea that allows an owner of a React Native app, in my case a retail store, to write JSX and store it in a db or file to be retrieved at runtime and transformed to code. I am aware of:

import { transform } from 'babel-core';

transform("code();", options);

but have not experimented with it yet.

I would like to do something like this:

export default class MyReactNativeComponent extends Component<{}> {
  render() {
    return (
         // Transform the string representation of JSX into code that render can return at run time
    );
  }
}

I have seen a few other libraries that do similar transformations.

What would be the best way to load JSX at runtime and is there anything else I need to consider with this approach ? I know this is similar to HTML being loaded in a browser, but I want to keep the native feel of the app.

Thanks,

Warren Bell