How can I use javascript library such as moment.js in react native

后端 未结 5 2009
臣服心动
臣服心动 2021-02-06 20:13

What is the recommended way to use native javascript libraries in react native? Are there any specific restrictions?

5条回答
  •  灰色年华
    2021-02-06 20:58

    to use a npm library just use this command with the respective library name

    npm install moment --save
    

    eg.) npm install {your library name here} --save

    then just import in your class and use

    import moment from 'moment';
    

提交回复
热议问题