Skip to content
Discussion options

You must be logged in to vote

I'm still not sure what your asking but the basic idea is that you would define your store model somewhere:

// store.js
import {types} from "mobx-state-tree";

const Store = types.model("Store", {
  time: types.string // or whatever it is you have in your store
}).actions(self=>({
  setTime(newTime) { self.time= Time; }
}));

export const store = Store.create();

And somewhere else you would have your React component class

// store-view.js
import * as React from 'react';
import { observer } from "mobx-react"
import { store } from "./store"

// You need observer so your component will react to changes in the store
@observer
export class StoreView extends React.Component {
  public render()…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by coolsoftwaretyler
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1490 on June 30, 2023 03:44.