DEV Community

JulSeb42
JulSeb42

Posted on

Maximising compatibility for a components library

I'm working on a components library in React, that I'd like to use with any React framework (CRA, Next.js, Remix, etc.).

The main questions here are:

  • How to approach links? I was thinking to implement react-router but this won't work with Next.js, right? Should I use html links instead, and add a prop to the component to use the react-router one or Next?
  • Same questions for other components of react-router: for Pagination component, I use createSearchParams to navigate to the selected page. How to approach this? Should I create only the buttons and implement the logic for navigation in the apps I'll create?
  • For styling: I'm used to style everything with styled-components. For frameworks using SSR (Next and Remix) won't this be a problem? Would I need to install styled in these projects? Wouldn't it be better in this case to use CSS modules?

Thanks for your answers!

Top comments (0)