3
7 Comments

A library for simple full-stack data loading in React

  1. 2

    Hi guys, I just shipped v2 of my library React Frontload - it basically gives you a batteries-included solution for loading data inline into React components using a hook that just works on both the client and server (with a bit of one-time setup of course)

    The 'loading data with a hook' thing is done by a few other libs. What I haven't seen other libs do is actually take care of the async server render, and client data hydration & sync parts, which react doesn't offer and something has to polyfill.

    Other libs tend to assume you're using something like NextJS to provide these features. With React Frontload they come out of the box, it's a truly dependency free solution that works with any React stack.

    E.g. if you have an existing React app without server rendering, want to add it but don't want to plumb in a load of complex data loading stuff manually OR port your app to a framework, React Frontload could be worth a look.

    Cheers, and let me know what you think!

  2. 1

    Hi David, do you know, offhand, if I could use this with MeteorJS and React? Meteor has both server and client portions, but I wonder if for what you have here, I could possibly use yours for hydration at times. Interesting prospect.

    1. 2

      Hi Fraser, yes you definitely can! One of the design goals of the library is to be able to slot into any React stack, so it should work with basically anything.

      This is an interesting usecase - I think typically people are using react-frontload instead of a framework, but I can definitely see how it could be useful on top of one for specific purposes.

      I'd be interested to hear how well this works for you, if you try it out!

      1. 1

        Then I will give it a try! Thank for the feedback, David

  3. 1

    This is super cool! Do you have an example of how it would work with Next.js or is this mainly for non-Next.js users?

    1. 3

      Hi Gabe. Very late reply here, sorry, somehow missed your comment at the time I posted!

      I think, in general, if you're already all in on a framework like Next it might make sense to just use its built-in server rendering features. React-frontload is really intended as a small library that provides that feature, if your framework doesn't have it or if you're not using a framework.

      1. 2

        Gotcha, makes sense, thanks :)

Trending on Indie Hackers
✨ Let's hack Twitter ✨ 55 comments I quit everything. I'm going all-in on Web3. 41 comments My SEO experience 15 comments Why I started following back everyone 7 comments How do you login users on you site? 5 comments How do I not quit? 4 comments