how to Include createjs library into reactjs project

柔情痞子 提交于 2019-12-11 14:18:28

问题


Hi I am creating an app on reactjs, which is canvas based, It require Createjs library, I am new for Reactjs I am not getting perfect idea how do this so I tried 2 ways one is using NPM install and other one is I kept my js into one folder and tries to import from there but nothing works for me, here my code

way 1 with npm install,
import createjs from 'createjs';

way 2 import downloaded js file,
import createjs from '../assets/js/createjsmin';

randomly I tried
import * as createjs from '../assets/js/createjsmin';

but nothing works for me


回答1:


I add relative path to index.html and got Createjs library code into componentWillMount() using window.createjs, dn't know but I feel it can work to add all ramdom libraries in react.



来源:https://stackoverflow.com/questions/50773434/how-to-include-createjs-library-into-reactjs-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!