Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: MountApp component #433

Open
fahad19 opened this issue Jul 13, 2018 · 0 comments
Open

Proposal: MountApp component #433

fahad19 opened this issue Jul 13, 2018 · 0 comments

Comments

@fahad19
Copy link
Member

fahad19 commented Jul 13, 2018

Currently

We use getMountableComponent(app) function, to get a component which has the app inside React's context.

Proposal

We can have a MountApp component, with usage like:

import { MountApp } from 'frint-react';

const fooApp; // instance

function BarComponent() {
  // render a given app with instance
  return <MountApp app={fooApp}>;

  // render a given app by name
  return <MountApp name="FooAppName" />

  // render any component against an app
  return <MountApp 
    name="FooAppName" /* or app={fooApp} */
    render={() => <SomeComponent />} 
  />;
}

Further usage

In frint-react: The MountApp component can then be used by Region component and render function internally too.

getMountableComponent can be deprecated.

Benefits

We don't have to depend on placing a Region with a name to mount an app somewhere. We can benefit from directly rendering an App somewhere without expecting any other App to share that region.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant