Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

convert class based component into functional online

import React, { Component } from "react";
import { InputGroup, FormControl, Input } from "react-bootstrap";
class SimpleKeyEvent extends Component {
  constructor() {
    super();
    this.state = {
      name: "React-bootstrap key enter event"
    };
    this.onKeyUp = this.onKeyUp.bind(this);
  }
  onKeyUp(event) {
    if (event.charCode === 13) {
      this.setState({ inputValue: event.target.value });
    }
  }
  render() {
    const { inputValue } = this.state;
    return (
      <div>
        <InputGroup>
          <FormControl placeholder="First name" onKeyPress={this.onKeyUp} />
        </InputGroup>
        <hr />
        <span>Input value is : {inputValue}</span>
      </div>
    );
  }
}
export default SimpleKeyEvent;
Comment

PREVIOUS NEXT
Code Example
Javascript :: save for wanver dev 
Javascript :: linux Error HH604: Error running JSON-RPC server 
Javascript :: does expo av support mp3 
Javascript :: if spreeding the properties on an input how to nnot include the invalid props that the input is not receiving 
Javascript :: starting: intent error type 3 react-native 
Javascript :: js function call itself 
Javascript :: angularfire 
Javascript :: sort array without using sort function in javascript 
Javascript :: javascript hover event listener 
Javascript :: how to get multiple values from json array using jq 
Javascript :: shell curl path of json file as parameter without temporal file 
Javascript :: limpiar historial angular 
Javascript :: Ajax in wordpredss 
Javascript :: javascript complex literal 2 
Javascript :: node-js-eacces-error-when-listening-on-most-ports 
Javascript :: get time in between two dates javascript dayjs 
Javascript :: searchable 
Javascript :: sample asynchronous 
Javascript :: docker containerize node app 
Javascript :: javascript Change color based on a keys value in each object of array 
Javascript :: Ant Media Filter Plugin for Text 
Javascript :: AngularJs: How to interpolate an interpolated string 
Javascript :: Angularjs onchange datetime picker not working 
Javascript :: Navigating to another Screen when a button is tapped in React Native 
Javascript :: Undefined value document.getElementById 
Javascript :: setup app files in node js 
Javascript :: assign-only-if-property-exists-in-target-object 
Javascript :: javascript datamatrix parser 
Javascript :: div auto extend win righting in 
Javascript :: function listview list grud abnAlhaj 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =