Within the project I am currently involved in, there is heavy reliance on dependency injection.
In this context, you will come across code structures similar to the following:
type BigWidget = {
title: string,
}
const AProps = {
b: BigWidget
}
class A extends React.Component<AProps> {
...
}
...
const a = <A b={observerB} />
The issue with prop b
highlighted above is that it can be instantiated in various ways
import * as mobxReact from 'mobx-react';
const observerB = mboxReact.observer( { title }: { title: string } ) => {...}
or
const anotherObserverB = mboxReact.observer( { title, extraFunction }:
{ title: string, extraFunction:() => void } ) => {...}
I am seeking a way to easily identify the object being passed to prop b
. Is there a straightforward method, such as checking if the observer has a prop extraFunction
, available in the development console?
Currently, when I type a
in the console, the displayed information is limited to just:
https://i.sstatic.net/GYgyN.png
which does not provide much insight.