I'm working on an Instagram clone (Just because I want to learn more about Next.js) and I want to manage the image uploads. Just want the user to upload his image and redirect it to the "create new post" page. The thing is, I don't know how to send the image between pages. I thought of doing a rest API to temporarily store the image and retrieve it, but that seems to be far too complicated. Does anyone have any idea of how I can implement this? I'm using Router from next.js if that helps.
Multiple ways depending your needs. You can try one of these.
Use React Context or a state management tool.
When routing from Page A to Page B, pass your data with querystring. Mask it with "as" prop if you dont want it to be shown on URL. If data is too big; pass it as a Blob URL. Then read query on the second page. https://nextjs.org/docs/api-reference/next/router#routerpush
Use localStorage. This is probably shortest way.