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

PortalGun: Dest accepts render callback #14

Open
brigand opened this issue Jun 19, 2018 · 0 comments
Open

PortalGun: Dest accepts render callback #14

brigand opened this issue Jun 19, 2018 · 0 comments

Comments

@brigand
Copy link
Owner

brigand commented Jun 19, 2018

Dest should accept a render callback which is always called when the Dest is re-rendered, or there's an update at a Source. The main use cases here are transitions, and wrapping the node in another element.

<Dest />

// same as...

<Dest>
  {(nodeOrNull) => nodeOrNull}
</Dest>

For transitions, it would be compatible with react-transition-group, without us doing anything special.

The general wrapper case allows conditionally rendering a wrapper, based on the node existing or not.

<Dest>
  {(nodeOrNull) => nodeOrNull
    ? <Modal>{nodeOrNull}</Modal>
    : null
  }
</Dest>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant