Skip to content Skip to sidebar Skip to footer

Adding Javascript And Css Files To React

I'm integrating d3-timeseries graph with react. So, this graph uses 3 files of its own 2 javascript files and one css file. files are available here : https://github.com/mcaule/d3

Solution 1:

use import

importReactfrom'react';
import d3Js from'https://d3js.org/d3.v3.min.js';
import'path/to/your/file.css';

exportdefaultclassMyNavbarextendsReact.Component {
    render(){
      return (
       <div> something </div>
      );
    }
}

Solution 2:

Because the rendering of d3 and React differ in their concepts, its quite hard to integrate d3 inside React.

Its maybe better to use the React-Way D3 which provides this package: http://www.reactd3.org

Post a Comment for "Adding Javascript And Css Files To React"