dimanche 22 août 2021

How can I pass a function to parent component in React?

In my React project, I want to keep all my functions in a single file and then I want to use the functions where I need. I can pass via props but that way I can't pass the function to parent components. Some people suggesting me to use context API. I can pass static data through context API but I don't know how can I pass the function. Can any one of you give me a possible solution or idea for this?




Aucun commentaire:

Enregistrer un commentaire