How Can I Access The State That Is Not In The Store In React?
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
Answer
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).
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?