Using MobX in a SPFx 1.7.x project

Copper Contributor

Has somebody successfully used MobX (especially with the React bindings) in a nontrivial SPFx 1.7.x project?

 

I'm developing a webpart with several React components where MobX will be used as a central state manager. Up to now I've experienced the following problems:

  • I can only use mobx-react version 5.2.8 or less because in more recent versions there is TypeScript code that the TypeScript compiler installed with SPFx (version 2.4.2) cannot handle;
  • Usage of the Provider component in mobx-react as a JSX tag results in a strange TypeScript error. The workaround I've found is to use React.createElement but this looks (and feels) weired.

This is only the start of the project and I'm wondering what else will pop up. So I'm curious if somebody has successfully used it and maybe has tips or pointers.

0 Replies