What I want to do is when I type some text in an input field, it should appear in another place realtime.
Below is my input;
There are actually people wanting to write with two-way binding, but React does not work in that way.
That's true, there are people who want to write with two-way data binding. And there's nothing fundamentally wrong with React preventing them from doing so. I wouldn't recommend them to use deprecated React mixin for that, though. Because it looks so much better with some third-party packages.
import { LinkedComponent } from 'valuelink'
class Test extends LinkedComponent {
state = { a : "Hi there! I'm databinding demo!" };
render(){
// Bind all state members...
const { a } = this.linkAll();
// Then, go ahead. As easy as that.
return (
)
}
}
The thing is that the two-way data binding is the design pattern in React. Here's my article with a 5-minute explanation on how it works