Tuesday, 2 May 2017

Define export for a module in javascript

Hey i am doing a small project using react-app and i have been trying all day to create export for this module i have installed it with npm, and i want to edit it so i can import and use it in my app.js

i have tried to define "reddit" using class\function\let and use either:

export default
module.exports

and either

 import reddit from 'reddit.js';
 var reddit = require('reddit.js');

and trying to check with a simple function from the module:

console.log(reddit.hot('cats'));

but still getting:

Uncaught TypeError: reddit.hot is not a function i am a bit lost, what am i doing wrong?



via Ben Porat

No comments:

Post a Comment