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 :: how do i make largest swap javascript stack overflow 
Javascript :: error check variable 
Javascript :: ngx-countdown npm 
Javascript :: Node Locking 
Javascript :: ismodified function 
Javascript :: discord.js create channel 
Javascript :: react native multiline cursor on first line 
Javascript :: Escaping special characters in JSON / list of invalid characters to strip from JSON string 
Javascript :: Merger Douplicate array Object 
Javascript :: chanhe button yext jquery 
Javascript :: regex reuse pattern 
Javascript :: jquery to vanilla js converter 
Javascript :: validate url javascript 
Javascript :: how to pass an id to the route of a seprate file react 
Javascript :: javascript zoom to meters 
Javascript :: js fix for rtl langages 
Javascript :: getx remove all previous routes 
Javascript :: mongodb match array not empty aggregation 
Javascript :: 4.6.3. Order of Operations¶ 
Javascript :: 3850 mod 17 
Javascript :: get nested value on object react using dot 
Javascript :: $("#heading").offset({ left: left Offset }); 
Javascript :: facebook graph X-Hub-Signature 
Javascript :: Using Math Functions in an IF statement 
Javascript :: array destructuring mdn 
Javascript :: how to pass custom parameter onchage 
Javascript :: react-chartjs-2 donut chart 
Javascript :: textfield extjs retrinjir a 4 caracteres 
Javascript :: Invariant Violation: [React Intl] An `id` must be provided to format a message. 
Javascript :: Make stepper with 2 values javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =