reactjs - Best way to pass parent methods as props to grandchild components? -


i have grandchild component needs change state of parent component. best way change state of of parent component onclick of grandchild component?

react docs mentions using context access methods. there people have used pass methods grandchildren?

the way doing passing parent component method via props child. creating new method in child calls parent method , passing child method grandchild via props. method called on grandchild , cascades parent set state of parent.

do need restructure components don't have many nested components? best practice here?

thanks!


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -