Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Call react component from one application to another application

I have one application named "primary-app" hosted on server 3006 and another application named "secondary-app" hosted on server 3008. I have used primary-app for all common component and utilizing components from "primary-app" to "secondary-app".

// app.js file from server http://localhost:3006
import React, { Component } from 'react';
import './App.css';
class App extends Component {
  render() {
    return (
      <div className="App">
        This is Common component
      </div>
    );
  }
}
export default App;

// app.js file from server http://localhost:3008
import React, { Component } from 'react';
import './App.css';
import AppComp from 'http://localhost:3006/src/App';
class App extends Component {
  render() {
    return (
      <div className="App">
        This is Common component
        <AppComp />
      </div>
    );
  }
}
export default App;

Currently I am not able to render localhost:3006 app component.

Comments