Javascript
(React.js) QWebview-plus 또는 Kiwoom-Helper를 가져다 쓰는법

키움헬퍼를 npm install 하고 import를 해주었습니다.

 

1. react에서는 사용할 수 없는건지,

2. componentDidMount() 에서 키움핼퍼 함수를 호출하는게 잘못된건지,

3. 웹에서 키움증권 API를 갖다쓰고 싶은데, React로는 안된다면 어떤 언어로 해야하는지

 

등 모르겠습니다.

 

/* eslint-disable */    //waring 제거

import React, { Component } from 'react';
import {
  LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend,
} from 'recharts';
import dummyData from '../db/data.json';
import KiwoomHelper from 'Kiwoom-Helper';

const data = dummyData.data

class ChartTest extends Component {

  componentDidMount = async () => {
  
    console.log('*******************************');
    console.log("****   componentDidMount   ****");
    console.log('*******************************');
    const status = KiwoomHelper.getConnectState();
    console.log("status ====>"+status)

  }

  render() {

    return (
        <div>
            <h3> This is Chart page </h3>
            <LineChart
              width={600}
              height={350}
              data={data}
              margin={{
                top: 5, right: 30, left: 20, bottom: 5,
              }}
            >
              <CartesianGrid strokeDasharray="3 3" />
              <XAxis dataKey="name" />
              <YAxis />
              <Tooltip />
              <Legend />
              <Line type="monotone" dataKey="you" stroke="#8884d8" activeDot={{ r: 4 }} />
              <Line type="monotone" dataKey="market" stroke="#82ca9d" />
            </LineChart>
        </div>
    );
  }
}

export default ChartTest;

 

댓글 1