question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when trying to create a React wrapper for the library

See original GitHub issue

Hi, I found your library and I think it’s really cool! I’m trying to add it to a React project and I keep getting an error that Object(…) is not a function when calling the annotate function. I reproduced the behavior in a code sandbox. https://codesandbox.io/s/tender-river-k6d32?fontsize=14&hidenavigation=1&theme=dark

Idk what I’m doing wrong.

Thank you so much!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
pshihncommented, May 28, 2020

Seems like your project/webpack settings are not picking up the ‘main’ file from the package.json.

Try doing this instead:

import { annotate } from "rough-notation/lib/rough-notation.cjs.js";
1reaction
kbravhcommented, May 28, 2020

However, it does cause the typing and intellisense suggestions to no longer function as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrapping MUI with my library returns error - Stack Overflow
Try to delete reactjs in your node_modules, and run: npm install, then restart server this will use the component in your library.
Read more >
Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI ......
Read more >
How To Create Wrapper Components in React with Props
Wrapper components are components that surround unknown components and provide a default structure to display the child components.
Read more >
How to Create and Publish a React Component Library
This tutorial will take you through the process of creating and publishing your own custom React component library and hosting it on Github....
Read more >
Common mistakes with React Testing Library - Kent C. Dodds
Some mistakes I frequently see people making with React Testing Library. ... The return value from render is not "wrapping" anything.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found