You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LinkContainer should handle null or undefined locations by rendering the child component without modifications.
Why?
Imagine we have an array of model objects and want to render them as a table or list. However, sometimes only some of them have links associated. We'd like to do something like:
In this case, when step.link is missing, we'd still like to render the ListGroup.Item component. However, LinkContainer complains that location is null and/or undefined, depending on what's passed in.
Possible Implementation
Haven't tested this, but I think it might be as simple as:
// …snip…
} = this.props;
++ if (!to) {+ return React.Children.only(children);+ }+
const href = history.createHref(
typeof to === 'string' ? { pathname: to } : to
// …snip…
The text was updated successfully, but these errors were encountered:
Feature Request
LinkContainer
should handlenull
orundefined
locations by rendering the child component without modifications.Why?
Imagine we have an array of model objects and want to render them as a table or list. However, sometimes only some of them have links associated. We'd like to do something like:
In this case, when
step.link
is missing, we'd still like to render theListGroup.Item
component. However,LinkContainer
complains thatlocation
is null and/or undefined, depending on what's passed in.Possible Implementation
Haven't tested this, but I think it might be as simple as:
The text was updated successfully, but these errors were encountered: