0

I want to call Class component method outside into another functional component.

`
**Component 1:**

class Demo extends Component {
constructor(props) {
        super(props);
this.login = this.login.bind(this);
}
login = () => {//Login logic
};
} 
export default Demo 

**Functional Component:**
import Demo from './Demo'; 
const DemoFunctional = (props) =>{const onChange = ()=>{Demo.login();};
}
`

I have tried for window object but its unmount when click on ribbon Icon. I have followed this Call a React component method from outside

Please provide good solution as our business is stuck on it.

0 Answers0