How to pass props to sibling component in Reactjs

0

Currently this two components are child components, so what I want to achieve here is to pass the props from Search component to Images component. Because I wrote everything in a function component, I thought this might be a great place for me

When user enters something in the input field it will automatically search for new images. In order to give you a better understanding of my issue, I will put a link to Codesandbox here. So I want to pass the props to the sibling component, so it will output the filtered search result.

So only files you need to look at are: Search.js, Images.js

Hi
void link to Codesandbox!

You can not just share props between them if they don’t have parent-child relationship. Just make it Parent-Child structure. The another solution is with redux. If you send a action, you will have a prop in your other component. And for third option, you can use context api, which i don’t recommend you.