How would you structure this Component? A challenge to all advanced React users...
I'm having a bit of trouble structuring this component and I really don't know what to do about my data flow, so all help is appreciated
I'm creating an app to track what you have done on your job, like a diary.
On the page /user/days/ you can add a new day. The main day component has 3 children each representing a section (general info, duration, timeline). The problem lies with the timeline component which has an array of activities and each of those activities is a separate component.
The Activity has to be a special component because it has among other details a Uppy file upload for that particular activity and I need to create a special Uppy uploader instance to link it to that activity.
> Day --> General --> Duration --> Timeline -> Array< Activity >
> Day --> General --> Duration --> Timeline -> Array< Activity >
The problem lies in the fact that the submit button is on the Day component, meaning that I want to trigger the Upload() function (which triggers uppy upload) from the Day component. Which then means I have to use useImperativeHandle from Activity up to Day component. And even then I don't know if I can do that because you pass the ImperativeHanlders when importing a component,
import UploadImageComponent, { ForwardedFunctions } from "@components/Upload/UploadBookCoverImage";
import UploadImageComponent, { ForwardedFunctions } from "@components/Upload/UploadBookCoverImage";
so I don't know if that works if I have to map those components.