Apollo/React mutating two related tables

Viewed 1059

Say I have two tables, one containing products and the other containing prices.

In Graphql the query might look like this:

option {
    id
    price {
      id
      optionID
      price
      date
    }
    description
}

I present the user with a single form (in React) where they can enter the product detail and price at the same time.

When they submit the form I need to create an entry in the "product" table and then create a related entry in the "price" table.

I'm very new to Graphql, and React for that matter, and am finding it a steep learning curve and have been following an Apollo tutorial and reading docs but so far the solution to this task is remaining a mystery!

Could someone put me out of my misery and give me, or point me in the direction of, the simplest example of handling the mutations necessary for this?

1 Answers
Related