MCPcopy Index your code
hub / github.com/mobxjs/mobx / get

Function get

packages/mobx-react/src/observerClass.ts:258–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

256 configurable: true,
257 enumerable: true,
258 get() {
259 const admin = getAdministration(this)
260 const derivation = _getGlobalState().trackingDerivation
261 if (derivation && derivation !== admin.reaction) {
262 throw new Error(
263 `[mobx-react] Cannot read "${admin.name}.${key}" in a reactive context, as it isn't observable.
264 Please use component lifecycle method to copy the value into a local observable first.
265 See https://github.com/mobxjs/mobx/blob/main/packages/mobx-react/README.md#note-on-using-props-and-state-in-derivations`
266 )
267 }
268 return admin[key]
269 },
270 set(value) {
271 getAdministration(this)[key] = value
272 }

Callers

nothing calls this directly

Calls 1

getAdministrationFunction · 0.70

Tested by

no test coverage detected