Please help. What's wrong with my code.
My model :
export default {
state : 0,
reducers: {
setToken : (state, payload) => state + payload
}
};
My action :
dispatch.auth.setToken(token)
The result is : "Unexpected token ','. Expected a ':' following the property name 'type'."
But if the code I change to be like this :
export default {
state : 0,
reducers: {}
};
no error at all.
What does your init look like?
If you're exporting the model with default like in the example above, your init should look something like this:
export default {
state: 0,
reducers: {
setToken: (state, payload) => state + payload
}
}
import { init } from '@rematch/core'
import auth from './models/auth'
const store = init({
models: {
auth: auth
}
})
store.getState() // { auth: 0 }
Try to turn off "Debug JS Remotely" in emulator.
@kertul was this an android related issue?
If so, it should be resolved in the latest version.
I think this is due to an error during the installation, because when I create a new project and use the same code this problem does not appear.
I remember, this error occurred after I installed axios. Forgive me for being less thorough.
Most helpful comment
@kertul was this an android related issue?
If so, it should be resolved in the latest version.