0

My whole project is using Pure Javascript and i would like try to create BizCharts in Index.js (Mix React) but it doesn't allow to.

Hence, i found this method useful to create React Element in Js. But i have no idea how to implement it. Link -> https://jsfiddle.net/charlos/kp7thgqx

My index.js

const e = React.createElement;

class LikeButton extends React.Component {
  constructor(props) {
    super(props);
    this.state = { liked: false };
  }

  render() {
    if (this.state.liked) {
      return 'You liked comment number ' + this.props.commentID;
    }

    return e(
      'button',
      { onClick: () => this.setState({ liked: true }) },
      'Like'

    // Render element here , i have no idea how to create chart elements with unknown attributes

    //  'Chart',
    //  { height: 400 , weight:300 },
    //  ''      
    // i tried like this ... hmmm looks silly and it doenst work lol 
    );
  }
}

Need more ideas and inspiration. I am stuck for days, just beginner to React. Any help is appreciate!

Ideally product : https://bizcharts.net/product/bizcharts/demo/61

Wes111222
  • 163
  • 1
  • 9
  • 1
    It's annoying to write but possible: https://jsfiddle.net/khrismuc/duorj1qL/ (note that you can use JSX without webpack if you use babel) –  May 18 '20 at 10:00
  • Thanks for reply! @ChrisG .. If i am using webpack , do i still need babel ? or i just import react and bizcharts?? – Wes111222 May 18 '20 at 10:14
  • 1
    If you have any setup that allows you to write JSX, just use bizCharts as documented. I don't understand why you're suddenly asking for the opposite of the question? –  May 18 '20 at 10:48
  • That is more than enough lol. Just for knowledge. Thanks @ChrisG ! – Wes111222 May 18 '20 at 12:57

0 Answers0