score:2

Accepted answer

you can add to the opener window a reference to the loginsuccess method that will dispatch the needed wanted action:

const store = redux.createstore(reducer);
window.loginsuccess = function(user) {
    store.dispatch(sampleactioncreator(user));
};

now you can access window.opener.loginsuccess() from the child.

score:0

in my projects, i manage popup/modal etc. into the parent component which triggers, passes params etc. to popup. popup page is only responsible for presentation. all behaviours (service calls from service layer, redux binds) is into my parent component.

i pass behaviours(funcs) and props to popup, so that when i need to change sth. i just update redux state. it's easy to manage components when using data oriented achitectures like redux.

my suggestion to you, if you don't have to, don't use dummy presentation components like behavioral components which has own methods, own behaviours.

score:0

you can use the messaging api between parent and child windows. look at the example inside the link, and notice there that you will need to implement event listener to the message you want to receive. so action can be dispatched accordingly.


Related Query

More Query from same tag