score:1

If I have understood your question you want to create component using extending class in react ja.


import React from ‘react’;
class Frame extends React.component{

    constructor(props){
       super(props);
       this.props = props;
       this.state = { hover: false}
    },

    toggleHover = (e) =>{
        this.setState({
            hover: !this.state.hover
        })
    },

    render() {
        if (this.state.hover){
            linkStyle = "blue";
        }else{
            linkStyle = "red";
        }

        var frameStyle = {
            width: 100,
            height: 100,
            backgroundColor: {this.props.linkStyle}
        };

        return (
            <div onMouseEnter={this.toggleHover} onMouseLeave={this.toggleHover} style={frameStyle}>
            </div>
        );
    }
}

Related Query

More Query from same tag