redux-wasp-apollo
v0.2.0 (beta)
Provides integration between redux-wasp and apollo-link-state.
For the base query, mutation, and subscription, check out wasp-graphql
.
For additional features unique to Redux, check out redux-wasp
.
For a live, full-stack application showcasing redux-wasp
in action, go here.
Purpose
Updating to Apollo 2.0+ and don't want to completely remove redux store/state? Just use ReduxWaspApollo to bridge the gap between the two! Pass in the new data you need to update Apollo's Cache with and let ReduxWaspApollo do the rest.
Usage
Pass your Apollo Client down as a prop. Pass props into the ReduxWaspApollo functions.
Example
index.js
;;;;; ;;;; const client = link: uri: 'http://localhost:3000/graphql' cache: ; ReactDOM;
app.js
;;; // Wasp Links;; // Wasp Fetch; let API = 'http://localhost:3000/graphql'; const mapStateToProps = { return user: state ;}; { superprops; } { e; // Wasp Query usage // Passing in props with Client passed down, as well as, the query to be used ; // Get information with WaspFetch ; } { return <div> <button onClick= this>Get Users</button> </div> ; } mapStateToPropsApp;
queries.js
; let addUser = gql` mutation addUser($name: String!, $pass: String!) { addUser(name: $name, password: $pass) { userName userPass } }`; let getUser = gql` query($id: ID!) { user(id: $id) { userName } }`;let getAllUsers = gql` { getUsers { userName } }`; ;
Contributors
Thanks goes to these wonderful people (emoji key):
marceca |
Reynolds A Colon |
Denny Temple |
kamo31 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
Code of Conduct
Read our Code of Conduct here.
License
Open Sourced under the MIT License.