2aa8beb4 | const ActionLink = (React, PropTypes, ReactRedux) => { class ActionLink extends React.Component { constructor(props) { super(props); } render() { const { action, children, ...props } = this.props; const { store } = this.context; const renderedRoute = store.pathForAction(action); |
40d8820d | |
2aa8beb4 | return ( <a href={renderedRoute} onClick={ev => { ev.preventDefault(); store.dispatch(action); }} {...props} > {children} </a> ); } |
478c0afb | } |
7a0c8d3f | ActionLink.propTypes = { |
2aa8beb4 | action: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), |
7a0c8d3f | children: PropTypes.node }; |
2aa8beb4 | ActionLink.contextType = ReactRedux.ReactReduxContext; |
384920b4 | return ActionLink; }; let OutComponent = ActionLink; try { const React = require("react"); const PropTypes = require("prop-types"); |
2aa8beb4 | const ReactRedux = require("react-redux"); OutComponent = ActionLink(React, PropTypes, ReactRedux); |
7a0c8d3f | } catch (e) { /* empty */ } |
40d8820d | |
384920b4 | export const _internal = { ActionLink }; export default OutComponent; |