You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @buckyroberts, I am following your redux tutorial in youtube and it's awesome. You made redux concept so easy.
But now, i am facing one issue in redux. If you can help me out from this, i will be very thankful.
I am trying to use socket.io in my react-native project. I created one SocketHelper.js file and i put all my events over there. Please check my code below.
import React from 'react'
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
window.navigator.userAgent = 'react-native';
import io from 'socket.io-client/dist/socket.io'
import { setRouteAction } from '../../ReduxModel/Actions/BusRouteAction'
var socket;
export function socketListener () {
socket = io('localhost://3000', {jsonp: false});
socket.on('connectionCheck', (response)=> {
console.log('socket connection' + response.message);
});
socket.on('getRoutesResponse', (response) => {
console.log('route json response : ' + response);
console.log(props)
});
}
function mapStateToProps(state) {
return {
user: state.user
};
}
function matchDispatchToProps(dispatch) {
return bindActionCreators({
routes: setRouteAction
}, dispatch)
}
export default connect(mapStateToProps, matchDispatchToProps);
and the issue is as i am not using a class here, how i can use routes (i.e. inside the matchDispatchToProps) as props to dispatch my data.
Please let me know, if i am missing any concept or anything i am doing wrong.
The text was updated successfully, but these errors were encountered:
Hey @buckyroberts, I am following your redux tutorial in youtube and it's awesome. You made redux concept so easy.
But now, i am facing one issue in redux. If you can help me out from this, i will be very thankful.
I am trying to use socket.io in my react-native project. I created one SocketHelper.js file and i put all my events over there. Please check my code below.
and the issue is as i am not using a class here, how i can use routes (i.e. inside the matchDispatchToProps) as props to dispatch my data.
Please let me know, if i am missing any concept or anything i am doing wrong.
The text was updated successfully, but these errors were encountered: