Skip to content
Discussion options

You must be logged in to vote

.props() is just another builder method on model types that allows you to add or override props given to a model. See docs.

const SomeModel = types.model({ firstName: "Tyler"}).props({ lastName: "Williams" })
const modelInstance = SomeModel.create()
console.log(modelInstance.firstName) // Tyler
console.log(modelInstance.lastName) // Williams

More useful if you're extending an existing model, in my opinion. But some people use props instead of the initial properties argument to the types.model function.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@OnkelTem
Comment options

@coolsoftwaretyler
Comment options

Answer selected by coolsoftwaretyler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants