DEV Community


FEC Day 11-13

shimoshi profile image Timothy Nguyen ・1 min read

I haven't in a while but let me try to remember based on my notes and memory. During this time I completed getting my modal to post data to the API. This proved very challenging because the database required large amounts of different info. It seemed a little daunting because my modal would require a bunch of controlled components. However after grabbing all the data I needed from the state and adjusting my sent data constantly, I was finally able to make a successful post! I remember feeling deeply satisfied as this was a major feature of my section. I also solved an issue with resetting my state whenever the product changed in the parent. I had to choose between moving my state and methods up to the parent or an alternative. The alternative I found was to set the key of my main component to equal the product's ID. So whenever the product changed, so did the key of my component. This would force the component to unmount and remount with a fresh state, which is exactly what I needed!

Discussion (0)

Forem Open with the Forem app