What are model .props() and how to use them? #2264
-
What are model Can I give labels to fields using them? |
Beta Was this translation helpful? Give feedback.
Answered by
coolsoftwaretyler
Apr 7, 2025
Replies: 1 comment 2 replies
-
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 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
coolsoftwaretyler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.props()
is just another builder method on model types that allows you to add or override props given to a model. See docs.More useful if you're extending an existing model, in my opinion. But some people use
props
instead of the initial properties argument to thetypes.model
function.