Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140190

How can i make this const into class on react.js

$
0
0
import React, { useState, Component } from 'react';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Row, Col, CardHeader, CardBody, Card, } from 'reactstrap';

const ModalBuySell = (props) => {
  const {
    buttonLabel,
    className
  } = props;
  const datas = props;

  const [modal, setModal] = useState(false);

  const toggle = () => setModal(!modal);
  return (
    <div>
      <Button color="danger" onClick={toggle}>Buy / Sell</Button>
      <Modal isOpen={modal} toggle={toggle} className={className}>
        <ModalHeader toggle={toggle}>{datas.name} (No. ID {datas.id}) Transaction(s)</ModalHeader>
          <ModalBody>
            <Row>
              <Col>
                <b>In-hand Quantity</b>
              </Col>
              <Col xs="1">
                <i className="fa fa-arrow-right"></i>
              </Col>
              <Col>
                {datas.inHand}
              </Col>
            </Row>
          </ModalBody>
        <ModalFooter>
          <Button color="secondary" onClick={toggle}>Cancel</Button>
        </ModalFooter>
      </Modal>
    </div>
  );
}

export default ModalBuySell;

I tried to give my button some onChange function but first i need to make this to class, i'm beginner so i just search on the internet but all the solutions makes me use class instead of my code like that.


Viewing all articles
Browse latest Browse all 140190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>