Allows inter-widget communication.
This function yields this Renderer's own internal widgets, and it's used in two places.
First, we expose our own internal widgets to each other by giving them
a findWidgets function that, in turn, calls this function.
Second, we expose our own internal widgets to this Renderer's parent,
by allowing it to call this function directly. That way, it can hook us
up to other Renderers on the page, by writing a findExternalWidgets
prop that calls each other Renderer's findInternalWidgets function.
Takes a filterCriterion on which widgets to return.
filterCriterion can be one of:
Returns an array of the matching widget components.
If you need to do logic with more than the components, it is possible to do such logic inside the filter, rather than on the result array.
"Remember: abilities are not inherently good or evil, it's how you use them." ~ Kyle Katarn Please use this one with caution.
Allows inter-widget communication.
Includes both widgets internal to this Renderer, and external widgets
exposed by the findExternalWidgets prop.
See findInteralWidgets for more information.
Returns an array of all widget IDs in the order they occur in the content.
Serializes widget state. Seems to be used only by editors though.
StaticcontextIf set, this.context will be set at runtime to the current value of the given Context.
StaticdefaultCalled immediately after a component is mounted. Setting state here will trigger re-rendering.
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
cancelled network requests, or cleaning up any DOM elements created in componentDidMount.
Returns an array of widget ids that are empty (meaning widgets where the
learner has not interacted with the widget yet or has not filled in all
fields). For example, the interactive-graph widget is considered
empty if the graph is in the starting state.
Returns a JSON representation of the content and widgets that can be passed to an LLM for prompt context.
Returns an object of the widget .getUserInput() results
Called to determine whether the change in props and state should trigger a re-render.
Component always returns true.
PureComponent implements a shallow comparison on props and state and returns true if any
props or states have changed.
If false is returned, Component.render, componentWillUpdate
and componentDidUpdate will not be called.
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component.setState generally does not trigger this method.
This method will not stop working in React 17.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
If using the new style context, re-declare this in your class to be the
React.ContextTypeof yourstatic contextType. Should be used with type annotation or static contextType.