load component dynamically to react native app from external url

Viewed 838

Is it possible to load a component into a bundled react-native app dynamically and from an external URL?

Example of what I eventually want to achieve

const id = await fetch('http://example.com/getid/');

import CustomModule from `http://example.com?id=${id}`

export default class App extends React.Component {
  render() {
  return (
    <View style={styles.container}>
      <CustomModule />
    </View>
  );
 }
}
1 Answers

Importing of external URL Component is not possible as of today.

If you have a Component hosted on an external Link, clone/copy/download that in your Project and import that.

or

If you have a set of common components, you can host them on a private npm registry and then add them in package.json and import them in your code.

Related