how can i make extendObservable work when i use pojo object?
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 286
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Hi i test code like below,but it got undefined,i use latest umd mobx code,thanks for your help,
var Person = function (firstName, lastName, age) {
this.id = .uniqueId('person');
mobx.extendObservable(this, {
firstName: firstName,
lastName: lastName,
age: age,
fullName:function () {//error code
console.count('fullName');
return this.firstName + ' ' + this.lastName;
}
});
};
var person = new Person('Matt', 'Ruby', 0);
mobx.autorun(function () {
console.log(person.fullname);//get undefined
});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the inline constructor and autorun snippet as the reproduction; first compare the observable property declared in extendObservable with the property accessed by autorun. Done means the example runs without an undefined value and produces the intended full-name output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100