DEV Community

Discussion on: 👨‍🔬 I tried experimental React and... 💥💥💥

Collapse
 
thorocaine profile image
Jonathan Peel

This is interesting and I am going to try it, I just don't understand what is happening with that wrapper.
Where does the read method come from?
It's like you want the result of the parameter to the method.
(I will still give it a go. If it works, it works).

The next question I would ask would be if you need to pass a parameter to the API.
I guess you would just need to create a method to return this method (:P) and "read" it from a callback. (or do it the old way)

Collapse
 
potouridisio profile image
Ioannis Potouridis

I'll send you two examples from React that answer your questions.

You can see the implementation of that method here.

And here is how you pass a parameter.

Collapse
 
thorocaine profile image
Jonathan Peel

That is nicely put.

Until this is actually ready, I might stay away, but it makes me want to try and create a wrapper function for an API call that would return the result of a reducer (if that makes sense).
The loading state would still need to be managed.