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: Region component with render prop support #428

Closed
fahad19 opened this issue Jul 11, 2018 · 0 comments
Closed

Proposal: Region component with render prop support #428

fahad19 opened this issue Jul 11, 2018 · 0 comments
Labels

Comments

@fahad19
Copy link
Member

fahad19 commented Jul 11, 2018

Currently

We can only access props passed to Region via RegionService. This involves working with providers and streams.

Somewhere in RootApp:

import { Region } from 'frint-react';

export default function SomeComponent() {
  return <Region name="sidebar" data={{}} />;
}

And in Child App:

export default observe((app) => {
  return app.get('region').getData$();
})(MyChildAppComponent);

Proposal

We can stay more close to the React-land, if we can also support render props pattern with Region component.

Somewhere in Root app:

import { Region } from 'frint-react';

export default function SomeComponent() {
  return (
    <Region name="sidebar" data={{}}>{
      (list, props) => list.map({ Component } => (
        <Component data={props.data} />
      ))
    }</Region>
  );
}
  • list: has all the Child Apps' components
    • Component: individual root component of Child Apps
  • props: props passed to Region component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants