r/reactjs • • Jun 03 '18

Beginner's Thread / Easy Question (June 2018)

Hello! just helping out /u/acemarke to post a beginner's thread for June! we had over 270 comments in last month's thread! If you didn't get a response there, please ask again here! You are guaranteed a response here!

Soo... Got questions about React or anything else in its ecosystem? Stuck making progress on your app? Ask away! We’re a friendly bunch. No question is too simple.

The Reactiflux chat channels on Discord are another great place to ask for help as well.

Pre-empting the most common question: how to get started learning react?

You might want to look through /u/acemarke's suggested resources for learning React and his React/Redux links list. Also check out http://kcd.im/beginner-react.

32 Upvotes

537 comments sorted by

View all comments

Show parent comment

1

u/swyx Jun 20 '18

mm you might not even be exporting wrong at all. this error:

Module not found: Can't resolve 'react-subreddit-posts'

suggests that your npm module resolution in your app is the issue, not the library exporting itself (altho that could well be part of it, im no expert). is react-subreddit-posts in your app's package.json? double + triple check? because honestly that module not found message is not at all the error i would expect (but then again ive never had this error and ive published a few libraries).

walk away from this for awhile and try some other create react library tutorial. try using create-react-library too! once you have a working example, come back to your own thing and compare the two.

1

u/bayhack Jun 20 '18
  "name": "react-subreddit-posts",
  "version": "1.0.11",
  "description": "React component for displaying subreddit posts in different styles",
  "main": "dist/main.js",```

I mean it's right there, if that's what you mean. And yes I think I am exporting itself fine. but def something up with module resolution. my example app is made with `create-react-app` 

And smart I'll just have to do that I guess. 

How often do you use `create-react-library` to tell the truth i'm trying to break myself of those dependencies, so I'm trying to not rely on the boilerplates as much. 

1

u/swyx Jun 20 '18

i use it for every new library haha. it just makes it so easy.