manu.js manu.js - 2 months ago 27
React JSX Question

How to update a value in reactjs component from outside react

I am new to the technology reactjs. I would like to know how I can show a value from text input which is not rendered using react to a react component which is simply a label which shows that value. Any help would be immensely appreciated.

Thanks in advance..

Answer

Simply call the javascript from the React component. E.g.

const value = document.getElementById('text').value;

Here's a fiddle with it all working.

https://jsfiddle.net/ht7tzn5k/2/

Comments