You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to pass a callback to angular component from react component?
I have an angular component that is a child of react component. The mapping from the parent (react) to the child (angular) works fine with < bindings. What I need is the other way communication: from the child (angular) to the parent (react) with '&' bindings. Is there a way to do it?
The text was updated successfully, but these errors were encountered:
When I pass the callback with &, the communication from child to parent is broken. However when I pass it with < or =, it works: the callback provided in react props is being called. The question is how robust this approach is. What do you say?
I am not too familiar with angular internals, so I would like to hear an opinion from someone more experienced.
Hi @korya. Unfortunately, React only supports 1-way bindings (<). The idea is to simplify the way data flows by eliminating 2-way bindings (=) and expression bindings (&).
Expression bindings are really a type of 1-way binding. You can update your code to use < bindings instead. For example:
// before
<componentonClick="onClick(value)"></component>
// after
<componentonClick="onClick"></component>
Is there a way to pass a callback to angular component from react component?
I have an angular component that is a child of react component. The mapping from the parent (react) to the child (angular) works fine with
<
bindings. What I need is the other way communication: from the child (angular) to the parent (react) with '&' bindings. Is there a way to do it?The text was updated successfully, but these errors were encountered: