Reputation: 590
I have a sequence diagram on the left side of my page and I have logs on the right. I use react-json-inspector library. This is provides list of logs. But I have a problem. When I clicked text of sequence diyagram , it goes to the item in the list. But the item in the list does not expand. There is an expand event in the library. I need to get to the state to expand this element. But it only renders initially. I need to reach the state that appears in this image. But this state is not inside my store. How can I access the state used by this library?
library link : https://github.com/Lapple/react-json-inspector
Upvotes: 1
Views: 52
Reputation: 8418
State is an internal responsibility of a component. You can't change it from outside - you can rerender component with changed props. Component can update internal state using changed prop.
This library/component does't look like interactively data-driven - it can be only initialized with some presets:
props.isExpanded
Optional predicate that can determine whether the > leaf node should be expanded on initial render.
You can extend this component to be aware of additional property (f.e. selectedNode
) - highlight/expand desired item (on start and change of this prop).
Upvotes: 1