Created
April 7, 2021 23:37
-
-
Save aqrojo/41c875f902eb8c3dc57a9022e6533958 to your computer and use it in GitHub Desktop.
mobx-introduction_MST_composition
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
const TemperatureModel = types.model({ | |
id: types.string, | |
value: types.number | |
}) | |
const CelsiusTemperature = types.compose ( | |
TemperatureModel, | |
types | |
.model ({}) | |
.views (state => ({ | |
get farenheight () { | |
return (state.celsius * (9/5)) + 32 | |
}, | |
})) | |
) | |
const FarenheightTemperature = types.compose (TemperatureModel, ...) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment