Convert Outlet from a HOC to a standard component with a render prop#63
Merged
Merged
Conversation
Outlet from a HOC to a standard component with a render propOutlet from a HOC to a standard component with a render prop
Outlet from a HOC to a standard component with a render propOutlet from a HOC to a standard component with a render prop
agubler
commented
Aug 13, 2018
| key?: RegistryLabel; | ||
| mapParams?: MapParams; | ||
| } | ||
| export interface MatchDetails { |
Member
Author
There was a problem hiding this comment.
Is OutletDetails a better name?
Member
There was a problem hiding this comment.
I think MatchDetails is more appropriate as it's the details for the current match, not the outlet as a whole. Perhaps MatchProperties though?
Member
Author
There was a problem hiding this comment.
Don't want to overload properties
tomdye
reviewed
Aug 16, 2018
| return Boolean(value && (typeof value === 'string' || typeof value === 'function' || typeof value === 'symbol')); | ||
| export interface OutletProperties { | ||
| renderer: (matchDetails: MatchDetails) => DNode; | ||
| outlet: string; |
tomdye
reviewed
Aug 16, 2018
| export function isComponent<W extends WidgetBaseInterface>(value: any): value is Component<W> { | ||
| return Boolean(value && (typeof value === 'string' || typeof value === 'function' || typeof value === 'symbol')); | ||
| export interface OutletProperties { | ||
| renderer: (matchDetails: MatchDetails) => DNode; |
Member
There was a problem hiding this comment.
Can this not return an array of DNodes ?
Member
Author
There was a problem hiding this comment.
I think it should be able to.
decc431 to
d3877cb
Compare
tomdye
approved these changes
Aug 16, 2018
528be9f to
2e592b9
Compare
JamesLMilner
approved these changes
Aug 16, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: feature
The following has been addressed in the PR:
prettieras per the readme code style guidelinesDescription:
This changes the
Outletfrom a higher order component to a standard component with a render property. The render property is used to display content when a route matches providing more control over the nodes to render when an Outlet's route has been matched.Having an
Outletas a HOC implies that it would be shared across the application (which generally they are not), adds complexity in it's usage by having to specify another interface for the properties that theOutletcan accept and has more boilerplate and indirection that if theOutletis a standard widget.Resolves #60
Alternative to #24