-
Notifications
You must be signed in to change notification settings - Fork 114
Conversation
Codecov Report
@@ Coverage Diff @@
## master #189 +/- ##
=======================================
- Coverage 99.55% 98.56% -1%
=======================================
Files 20 19 -1
Lines 227 209 -18
=======================================
- Hits 226 206 -20
- Misses 1 3 +2
Continue to review full report at Codecov.
|
🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 🔥 |
}; | ||
} | ||
constructor(props: Props, context: typeof Fragment.contextTypes) { | ||
super(props, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe you need context
to be declared in super()
if it's not being used in the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also don't need to pass props
, unless you're accessing this.props
in the constructor. React will populate them both on the instance for you.
} | ||
} | ||
|
||
export default compose( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is some next-level composition 🔥
👋 RouterProvider 🔥 🔥 |
@tptee you were thinking React Router does it. No harm no foul. Redux is king. Now we know. ...although there are a few things in |
Fragment
s no longer rely on static routes for matching. This is the first and most important step in making consumer components code-splittable.A few breaking changes fell out of this work:
Fragment
now depends on the order of the routes of its siblingFragments
, not the order of the static routes. Check out the test diffs for the behavioral differences. The biggest thing to remember is to put index routes (a nested/
) last in theFragment
hierarchy.RouterProvider
andprovideRouter
with 🔥 . We don't need them for matching hacks anymore, it's annoying boilerplate, and it rerenders the entire app on location change (wtf was I thinking when I wrote that???). We justconnect()
Fragment
andLink
now.connect()
ing our components resolves rendering bugs related to accessing mutatingcontext
. Redux and context don't play nicely AT ALL. We still use context to pass downparentRoute
andparentId
, but since there's rarely a need to dynamically change which route aFragment
matches on, we can safely assume that these values won't change after the first render (which is the prerequisite for using context safely with libraries likereact-redux
. We throw an error ifforRoute
changes for now. Supporting dynamicforRoute
props would require a subscription system like that inreact-redux
, and ain't nobody got time for that.