Let's imagine I'm developing a simple todo app, and in terms of react components it's structured like this (not actual react code)
<AddTodo />
<TodoList>
<TodoItem ..>
<TodoItem ..>
</TodoList>
TodoList
component is wrapped in graphql(gql '..some query')
HOC, and also into graphql(qql'..some mutation')
to handle querying of todo items and toggling their done
state; When a mutation is invoked TodoList
component knows to rerender itself with fresh data.
AddTodo
is wrapped with another HOC adding another mutation to add new todo item. However triggering it doesn't re-render TodoList
.
This little app doesn't have any state management like redux, my understanding is that React-Apollo is meant to replace redux. Why does refresh happen automatically in TodoList
and how to propagate refresh from AddTodo
?