score:2
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.
Source: stackoverflow.com
Related Query
- How to dispatch action from a child window?
- How to call dispatch action from child component in react?
- How to dispatch Redux action from stateless component when route is loaded?
- How to dispatch actions from Child components three level down?
- How can I dispatch from child components in React Redux?
- How can i dispatch an action from a helper function in react native
- How do I dispatch an action from a Container method in Redux?
- How to dispatch response data from api on action in react redux?
- Using useReducer to dispatch action from one child component and update state in another child component
- How to get newly created post id generated from backend API after dispatch createPost action to a reducer
- How to dispatch an action from the column formatter component of react-data-grid
- How to dispatch action from async.queue in react redux?
- How to prevent Redux dispatch from re-rendering the child components
- how to perform parent action from child in react
- How to dispatch an action from reducer react-redux
- How do i dispatch a redux action from class and not component
- Dispatch an action from a component with data from a child component
- How to dispatch an action from select
- React Native: How to dispatch redux action from Custom Drawer
- How to pass data from child component to its parent in ReactJS?
- How to update React Context from inside a child component?
- How to get simple dispatch from this.props using connect w/ Redux?
- Reactjs: how to modify dynamic child component state or props from parent?
- reactjs axios interceptors how dispatch a logout action
- How to set/change Field value from external user action 🏁 React Final Form
- How to prevent child component from re-rendering when using React hooks and memo?
- React hooks: dispatch action from useEffect
- React - How to pass `ref` from child to parent component?
- How to get values from child components in React
- How to dispatch an action when clicking on Link when using React-Router & Redux?
More Query from same tag
- How to define a state with JSON data (using react and axios)
- Removing a file from an array of files on click with react.js
- Displaying selected options in custom multiselect dropdwown as tags - React
- Declare Flow Types For Props Added By 3rd Party Component
- Do you really need to import 'React' when creating hooks? (React-hooks)
- How to make pass a test case which use enzyme shallow with contains when a React component has an event handler
- React Material UI – using UI Grid to split screen in half with one half scrollable and other half fixed
- Data from Axios is coming back undefined React
- React redux thunk how can I get one updated reducer value?
- Firebase - Request header field x-firebase-gmpid is not allowed by Access-Control-Allow-Headers in preflight response
- React JS: Browser console displays, "Uncaught TypeError: type.apply is not a function" and page comes out blank
- Correct way to update sate object field in React
- Passing property to component using component returned by HOC causes error
- React Router 4, how to check for a possible redirect on all routes?
- Getting undefined value. Javascript / React / mapping
- ReactJs protected route redirect/refresh issue
- '\"node build\bundle.js\"' is not recognized as an internal or external command, operable program or batch file
- Access cookies in a react app hosted on AWS Cloudfront-S3
- Issues with Background Larger than Circle Div CSS
- docker-compose, failed to solve: rpc error: code = Unknown desc = failed to compute cache key: "/app/package.json" not found: not found
- Deploying React App created by CRA (Create React App) to different ENVIRONMENTS, that have different URL PATHS?
- How to Close React App on Electron App Quit
- ReactJs update state from axios api data
- Bootstrap toggle (navbar) is not working on first load React
- How to pass an array to material-ui dataSource props
- Is there a way to leave just one component and link's content on the page?
- Backbone => React - Higher Order Components, inheritance and specialisation
- Issue in mapping arrays
- Page reload if react-router-dom doesn't match any route
- react bootsrap element not centering