Data binding in React

前端 未结 12 870
心在旅途
心在旅途 2021-01-30 19:49

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;



        
12条回答
  •  忘了有多久
    2021-01-30 20:38

    Don't need to Break head with setState() in react.js

    A new library made by me React-chopper

    Code Like angularjs in reactjs

    Code without setState in reactjs

    Go through examples for more description

    import React, { Component } from 'react';
    import { render } from 'react-dom';
    import Rcp from 'react-chopper';
    
    class App extends Component {
      constructor(props) {
        super(props);
        this.state = {
          name: 'React'
        };
        this.modal = Rcp(this.state, this);
      }
    
      tank = () => {
        console.log(this.modal)
      }
      render() {
        return (
          
    this.modal.name = e.target.value} />

    Bang Bang {this.modal.name}

    ); } } render(, document.getElementById('root'));

    Comments , Pr Are welcome ...Enjoy

提交回复
热议问题