title: React Context API - can children/consumers request that the provider change a value?
body: <p>I have previously used Redux, and am keen to implement Context API this time around. I pretty much want to do what is described in <a href="https://stackoverflow.com/questions/51480718/react-context-api-how-to-get-reference-to-state-object-in-provider-for-a-condi">React Context API - How to Get Reference To State Object In Provider For A Conditional Method</a> - however, I want the "change" function to be more general - it originally looks like this:</p>
  
  <pre><code>class ProviderComp extends Component{
      state={
          name: "Gary",
          age: 20,
          color: "Red",
          changeMind: ()=&gt;{
              if(this.state.color === "Red"){
                  this.setState({
                      name: "Tony",
                      age: 35,
                      color: "Blue"
                  })
              }
              if(this.state.color === "Blue"){
                  this.setState({
                      name: "Gary",
                      age: 20,
                      color: "Red"
                  })
              }
          }
      }
  </code></pre>
  
  <p>but rather than "changeMind()", I would like change(prop, val) so that calling:</p>
  
  <pre><code>change("name","Bob")
  </code></pre>
  
  <p>would change state.name to Bob</p>
  
  <pre><code>change("age", 30)
  </code></pre>
  
  <p>would change state.age to 30 etc</p>
  
  <p>Is this possible? I am trying to do something analogous to a child in Redux dispatching a request for a change, and a parent reducer receiving the request and updating accordingly.</p>
  
  <p>I'm probably thinking wrongly about Context, as I'm not just Providing upstream and then Consuming downstream, I'm trying to get downstream Consumers to send back requests to the proivder to change things - very open to being educated on a better way to think! </p>