Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function WithRPCRedux(props: Props) {
const reactReduxContext = React.useContext(ReactReduxContext);
const ctx = React.useContext(FusionContext);
const reduxPlugin = useService(ReduxToken).from(ctx);
const rpc = useService(RPCToken).from(ctx);
const wrappedMapStateToParams =
mapStateToParams &&
((state, args) => mapStateToParams(state, args, props));
const store = reactReduxContext
? reactReduxContext.store
: reduxPlugin.store;
const handler = createRPCHandler({
rpcId,
rpc,
store,
actions,
mapStateToParams: wrappedMapStateToParams,
transformParams,
});
return React.createElement(Component, {...props, [propName]: handler});
}
const displayName = Component.displayName || Component.name || 'Anonymous';