Property ‘profileStore’ is missing in type ‘{}’ but required in type ‘Readonly’.ts(2741)
Make profileStore props mandatory from: interface AppProps { profileStore: IProfileStore; } to optional interface AppProps { profileStore?: IProfileStore; }
Make profileStore props mandatory from: interface AppProps { profileStore: IProfileStore; } to optional interface AppProps { profileStore?: IProfileStore; }
Your login function is async and you need to use runInAction inside, or handle result in a separate action, or use some other way of handling async actions: import { runInAction, makeAutoObservable } from “mobx” class AuthStoreClass { authUser = null constructor() { makeAutoObservable(this) } login = async (params) => { const { data: { … Read more
The solution is to use cast: import { cast } from “mobx-state-tree” // ….. self.stores = cast(stores) This is because MST enables snapshots to be assigned to actual values, and automatically converts them. This doesn’t just apply to arrays, but to all types of values. However, typescript doesn’t have support for an assignment to be … Read more
This warning that you are getting is because you are setting a reference to clickMe method in the constructor, which is then using the setState(). constructor (props) { super(props) this.state = { initial: ‘state’, some: ” } this.clickMe = this.clickMe.bind(this); <— This method } clickMe () { this.setState({ some: ‘new state’ <– the setState reference … Read more