-
Notifications
You must be signed in to change notification settings - Fork 8
Week 3: Global state management #3
Conversation
</Switch> | ||
</React.Fragment> | ||
<Provider store={store}> | ||
<React.Fragment> |
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 don't need fragment anymore.
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 do, Provider
can have only one child element 🙂
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 think @varholak-peter is talking about replacing <React.Fragment>
with <>...</>
syntax.
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 believe Fragment
and <>
were released at the same time. Personally, I find Fragment
more readable.
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 think React.Fragment
was a workaround until Babel understood <></>
syntax.
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.
A always prefer less writing, so <></>
syntax for the win! On the other hand, it might be a bit confusing for students 😅
|
||
const Cart = connect(mapStateToProps)(CartView) | ||
|
||
export { Cart } |
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.
Why not exporting the Cart
directly?
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.
Just following the coding style laid out by guys before me, other pages use the same approach.
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.
@varholak-peter, I've been advocating for this approach on my last lecture (it was my personal recommendation and not a requirement, although I would love to keep it consistent in the whole project). Here is a good explanation of that: https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html.
|
||
```js | ||
const users.pop() // wrong | ||
const newUsers = users.filter(u => u.id !=== user.id) // right |
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.
!===
too many equal signs 😄
@@ -1 +1,69 @@ | |||
# Global state management |
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.
Add presentation link 👍
No description provided.