Created
August 7, 2018 09:28
-
-
Save ItamarShDev/c5b320d2d262bf48558e9544366c1cae to your computer and use it in GitHub Desktop.
The mobx problem example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inject('appStore') //different store | |
@observer | |
class VocalTest extends Component { | |
constructor(props) { | |
super(props); | |
this.hearingTest = new Store(this.props.appStore.devices); | |
this.prepareTest(); | |
} | |
playNoise(valueToPlay) { | |
//play to device | |
} | |
/* How can i acheive the following? | |
* if hasChanged(valueToPlay) { | |
* playNoise(valueToPlay) | |
* } | |
*/ | |
render() {...} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { observable, action } from 'mobx'; | |
class Store { | |
definition = null; | |
@observable settings; | |
@observable device; | |
//change to objects | |
@observable loopIndex; | |
@observable flowIndex; | |
@observable canPlay; | |
@observable canMark; | |
@observable valueToPlay; | |
/** | |
* more data | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment