Articles → REACT.JS → Set The Attribute Of The HTML Element In React.Js

Set The Attribute Of The HTML Element In React

Specifying The Attribute

import React, { Component } from 'react';
import ReactDOM from 'react-dom'

class Message extends Component {
    message = "Hello world";

    render() {
        return (
            <input type="textbox" value={this.message}/>            

ReactDOM.render(<Message />, document.getElementById('root'));


Picture showing setting the value attribute of a textbox
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Wednesday, August 4, 2021


Your Email Id  
Query/FeedbackCharacters remaining 250