Editor doesn't rerender when I change the 'value' props
See original GitHub issueI am using two editors at same time. An update in one editor should update the second one and viceversa. I have used same state variable in both editors and i have handled onChange in both editors by changing the state variable jsonData
. Still when I change JSON data in one editor the other one doesn’t rerender. It remains same. The following is my code:
`<div> <Editor value={this.state.jsonData} ajv={ajv} onChange={ (jsonData) => this.setState({ jsonData }) } search={false} navigationBar={false} /> <Editor value={this.state.jsonData} onChange={ (jsonData) => this.setState({ jsonData }) } mode=“code” />
</div>`Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:25 (8 by maintainers)
Top Results From Across the Web
React prop value not updating in object initialization during re ...
1 Answer 1 ; export const ; { onChange, leaseDocument, save, rentTableData }: any) => { // rentTableData is the prop that will...
Read more >When does React re-render components? - Felix Gerschau
this.props.user.name = 'Felix'; Don't do this! Instead of changing the props like this, you need to change the state in the parent component. ......
Read more >Hooks FAQ - React
Do Hooks replace render props and higher-order components? What do Hooks mean for ... How to read an often-changing value from useCallback? Under...
Read more >Re-rendering Components in ReactJS - GeeksforGeeks
A second or subsequent render to update the state is called as re-rendering. React components automatically re-render whenever there is a change ......
Read more >Change state without Re-rendering in React - Anshul Jain
In React, whenever the Props or State of the component change, ... to re-render where useRef doesn't re-render on updating the values.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vankop thank you so much for your answer!
@markdemich you need to get
ref
of<JsonEditor />
to get access to editor instance explicitly. For instance:then you can do what ever you want with
jsonEditor
using api