Hi, everyone! I developed this simple little lib (my first lib!) to help me reduce some repetition in my actions. I have some ideas of new implementations and I just want to see if anyone is interested in this at all or find this project interesting and useful. If you have any constructive critiques I would be very pleased to hear it. If you have some interest in the project and can help, it would be awesome!
The problem:
Let's say that I want to fetch a list of books. Using redux, I have to create three actions:
the first one is the "REQUEST" action;
the second one is the "SUCCESS" action;
the third one is the "FAIL" action.
Now let's say that I want to fetch a list of authors. Or a list of users. Or a list of bookmarks... This pattern of REQUEST-SUCCESS-FAIL can become very repetitive and verbose.
The solution
Using reshort you can create one "complete action" using one line, instead of three. Like so:
Left leaning Catholic who spends his time, running after his daughter, playing the Ukulele, singing Tenor in a choir, and tinkering with things. Husband to the lovely https://twitter.com/Abell_Design
This is a nice simple idea, and a great candidate for your first lib - I certainly have felt there being a bit too much boilerplate code for redux in the past.
One piece of functionality I'd like is to let the user define how they want their payloads to render. I like defining my values explicitly rather than having a payload value that could have anything inside it.
I'd consider doing this by letting the user pass a method that adds the data to the type... actually, I'm going to create an MR while I think this through... :D
I hope I'm not too late!
Reshort - write less in your actions!
Intro
Hi, everyone! I developed this simple little lib (my first lib!) to help me reduce some repetition in my actions. I have some ideas of new implementations and I just want to see if anyone is interested in this at all or find this project interesting and useful. If you have any constructive critiques I would be very pleased to hear it. If you have some interest in the project and can help, it would be awesome!
The problem:
Let's say that I want to fetch a list of books. Using redux, I have to create three actions:
Now let's say that I want to fetch a list of authors. Or a list of users. Or a list of bookmarks... This pattern of REQUEST-SUCCESS-FAIL can become very repetitive and verbose.
The solution
Using
reshort
you can create one "complete action" using one line, instead of three. Like so:This is a nice simple idea, and a great candidate for your first lib - I certainly have felt there being a bit too much boilerplate code for redux in the past.
One piece of functionality I'd like is to let the user define how they want their payloads to render. I like defining my values explicitly rather than having a payload value that could have anything inside it.
I'd consider doing this by letting the user pass a method that adds the data to the type... actually, I'm going to create an MR while I think this through... :D
Hey, Joseph! Thanks for taking the time to contribute!