简体   繁体   中英

How to access a method of app component in other component or service in React JS

I am working on a react application and want to implement react-notifications-component for notifications. I don't know how to call it's addNotification method from every component.

如果你想在另一个组件中调用一个组件的函数,你必须通过props传递对它的引用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM