Reputation: 13
I have two siblings class components and I am trying to call a function with arguments that resides in the PMtoXX from the XYtoPM. I am stuck of how to pass on the parameters and invoke the function. I get the error that the plot_PMSegment expected one argument.
` PMtoXY.tsx
class PMtoXY extends Component<IProps> {
----
plot_PMSegment = (beg_routeid, end_routeid) => {
-----
}
}
export default PMtoXY;
and I have this sibling component that I am trying to call the PMtoXY function from it.
XYtoPM.tsx `
class XYtoPM extends Component<IProps> {
import PMtoXY from "./PMtoXY";
----
-----
new plot_PMSegment(therouteid, theend_routeid)
-----
export default XYtoPM
Upvotes: 0
Views: 39
Reputation: 13
I found my answer from one of the suggestions (not the answer) provided on this posting: How to call a function from another class in React-Native?
The suggestion was: "You dont initiate your class, to solve this you need to change the B.abc() to new B().abc();"
Upvotes: 1