I'm lost on this. when I run 'yarn run build' and then 'serve -s build' to take a look at my app locally, this.props is returning something not expected. I believe there is something wrong with my connect function.

import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import * as actionCreators from '../actions/actionCreators.js';
import Main from './Main';


function mapStateToProps(state){
    return {
        posts: state.posts,
        comments: state.comments
    }
}

function mapDispatchToProps(dispatch){
    return bindActionCreators(actionCreators, dispatch);
}

const App = connect(mapStateToProps, mapDispatchToProps)(Main);

export default App;

I'm expecting to get this when i console.log(App):

ƒ Connect(props, context) {
            _classCallCheck(this, Connect);

            var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));

            _this.version = version;

but instead when I console log App I get this:

{$$typeof: Symbol(react.memo), type: ƒ, compare: null, WrappedComponent: ƒ, 
displayName: "Connect(t)", …}
$$typeof: Symbol(react.memo)
WrappedComponent: ƒ t()
compare: null
displayName: "Connect(t)"
type: ƒ d(n)
apply: ƒ apply()
bind: ƒ bind()
call: ƒ call()
Symbol(Symbol.hasInstance): ƒ [Symbol.hasInstance]()
__proto__: Object

0 Answers