Skip to content

Instantly share code, notes, and snippets.

View retry51776's full-sized avatar
๐ŸŒ

Terry Wu retry51776

๐ŸŒ
View GitHub Profile
@retry51776
retry51776 / connect.js
Created June 23, 2017 14:57 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (