React : Setting scrollTop on Div doesn't work in a specific case
0 I have been stuck at this since today morning and I still can't figure out where did I go wrong. I wanted to highlight text inside a textarea input type. I know this isn't possible, but I found a clever solution to cheat the viewer into thinking that. Here is the link to the article and Here is the link to the codeio pen for the project. I have been trying to recreate the same using react and normal javascript but the scrollTop property for div with className highlight just doesn't work. If someone could help me debug what I'm doing wrong, that would be wonderful! class CodeTextArea extends React.Component constructor(props) super(props); this.state = scrollTop: 0, scrollLeft: 0 ; this.setScroll = this.setScroll.bind(this); setScroll(top,left) this.setState(scrollTop: top, scrollLeft: left); render() return( <div class="container"> <div class="backdrop"> <Highlight scrollTop=this.state.scrollTop scrollLeft...