Last active
March 14, 2017 10:29
-
-
Save einarlove/674b21f16a5cba4fadbbcaffaa92711b to your computer and use it in GitHub Desktop.
React firebase deep subscriptions sketches
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
const createQuery = query => ({ | |
[REACT_FIREBASE_QUERY_SYMBOL]: true, | |
query, | |
}) | |
export default connect(props => ({ | |
pathSubscription: 'path/to/data', | |
deepSubscription: { | |
a: { | |
aa: 'path/to/data/a/aa', | |
}, | |
b: 'path/to/data/b', | |
}, | |
aQuerySubscription: createQuery({ | |
path: 'path/to/other/data', | |
orderByChild: 'order', | |
}), | |
}))(App) | |
connect(props => ({ | |
game: `games/${props.id}`, | |
players: ({ game }) => mapValues(game.players, id => `players/${id}`) | |
}))(Game) | |
compose( | |
connect(props => ({ | |
game: `games/${props.id}`, | |
}), | |
connect(props => ({ | |
players: mapValues(props.game.players, id => `players/${id}`), | |
}), | |
)(Game) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment