I don't get data of sectionId in ThemeModal component

26 Views Asked by At

I am currently working on the Shopify remix app. I made one route app.sections. I write a query to get data from the database in the loader function and export it to my component now in my component I pass this data to another component named ProductCard through props and again pass this data from ProductCard to ThemeModel component. In my Product card components there is one button named Install section and onClick of the button I show the ThemeModel component. ThemeModal is a one Modal which shows a list of themes of Shopify online store. there is one submit button at the end of themeModal where I use the Form API of Remix and give an action path to the app/section route. so when I click the button this functionality works but every time I get the section-id 1. So how can I get a different section-id when I click on different sections?

1 - map on totalSection and give to the ProductCard component 2 - Give totalTheme and section_id from ProductCard to ThemeModal component 3 - use the ThemeModal component and give section_id and selectedThemeId at the Submit button.

<Form
  method="post"
  action={`/app/section/${postId}`}
>
  <input type="hidden" value=(active_section_id) name="section_id" />
  <input type="hidden" value={selectedOption} name="selectedThemeId" />
  <button
    name="_action"
    type="submit"
    value="create"
    onClick={() => shopify-modal.hide("my-modal")}
  >Submit</button>
</Form>
[1 image]:(https://i.stack.imgur.com/GPKHu.png)
[2 image]:(https://i.stack.imgur.com/iT4OB.png)
[3 image]:(https://i.stack.imgur.com/BtU6z.png)

So, I want that when click on the submit button of ThemeModal, I don't get a different section-id. I only get every time section-id = 1.

0

There are 0 best solutions below