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

Enable default children on gateway destination #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wieseljonas
Copy link

This is very useful for me as I use Gateway for my navigation and it enables me to change navigation items from every every route or have the default value displayes

@srph
Copy link

srph commented May 4, 2019

For the mean time, if anybody's interested, I made a component that allows this instead.

import * as React from 'react'
import { GatewayDest } from 'react-gateway'

function GatewayDestWithFallback(props) {
  return (
    <GatewayDest name={props.name} component={Inner} fallback={props.fallback}>
      {props.children}
    </GatewayDest>
  )
}

function Inner(props) {
  return props.children || props.fallback || <div />
}

export default GatewayDestWithFallback

Usage

 <GatewayDestWithFallback name="my-top-nav-title" fallback={<Logo />} />

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

Successfully merging this pull request may close these issues.

2 participants