-
Question
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
What problem are you running into using MST with class components. Can you share an example of the issue you're running into. Also this might be a better fit for the Spectrum channel or stack overflow, since its not an issue with MST but a question as to its use. |
Beta Was this translation helpful? Give feedback.
-
import * as React from 'react'; export interface InforProps { export interface InforState { const ROOT: ViewStyle = { export default class InforComponent extends React.Component<InforProps, InforState> {
} This is the package I use: |
Beta Was this translation helpful? Give feedback.
-
I'm still not sure what your asking but the basic idea is that you would define your store model somewhere:
And somewhere else you would have your React component class
|
Beta Was this translation helpful? Give feedback.
-
@tunm1228 In order to avoid imports you should create a context provider with your store, then access the context in your components the normal way: |
Beta Was this translation helpful? Give feedback.
-
Hey @tunm1228 - looks like it's been a while on this MST issue. Lots of good replies here. Did you find them helpful? If not, I'm happy to chat if this is still a relevant problem. I'm going to convert this to a discussion, which will close the issue, but give you the option to mark helpful answers. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Marking @Ghirigoro's answer as correct here since I think that's a pretty clear solution to the original question. |
Beta Was this translation helpful? Give feedback.
I'm still not sure what your asking but the basic idea is that you would define your store model somewhere:
And somewhere else you would have your React component class