ohansemmanuel / fake-medium Goto Github PK
View Code? Open in Web Editor NEW💥 A tiny (super tiny) medium article page + clap animation for demo purposes.
💥 A tiny (super tiny) medium article page + clap animation for demo purposes.
Hi Ohansemmanuel
Nice work - this was very helpful to me.
It looks like you don't have a license file in this repo. Would you mind adding one? Without this, the code can not legally be used in other applications.
Thanks
Hi, I just noted that in the function actions/index.js
you have specified a onFailure function equal to console.log("Error occured loading articles")
, I suppose what you meant there is an arrow function like this ? : () => { console.log("Error occured loading articles"); }
So that IF there is an error that lambda function is called.
Really nice tutorial, it helped me a lot!
Best, Phil
export function newProfile(data) {
return new Promise((resolve) => (dispatch) => {
apiAction({
url: '/profile',
data,
onSuccess: ((response) => {
dispatch({
type: NEWPROFILE,
payload: response.id
});
resolve(response.id);
}),
label: LOADING,
});
});
}
props.newProfile(data).then((id) => {
// get id
});
¿How to solved?
HI,
that data fetching with redux middleware is really good but I'm thinking what we should do when we don't want to pass request data into store every-time? For example I have small component which should store some data from api request in the state, I don't want to push everything into store. Do you have any idea how to manage this?
Hi,
Your way of implementing a generic api middleware is great.
I am using 'UseDispatch' from react-redux library, here i will dispatch to an action and do an api call and update the redux store using reducer.
But my requirement is "need to wait till the redux store has data and then proceed further". Any idea how to get this ?
Can i make a specific api call from action method as async await when i call that action method from functional component or inside useEffect() i need to wait till i have data in redux store.
Regards,
Sandesh
Hello,
Allow me to first give you a round of applause and a huge thanks, your middleware is quite perfect, very beautiful coding. Yet I failed to see on how I could use it while working with several reducers because as you work with the article_details reducer when adding another reducer and duplicating the code to hold another set of actions, my two reducers collide and having this error :
Given action "API_START", reducer "reducerOne" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.
=> both reducers hold the same case API_START when the middleware dispatch it on onSuccess(data)
My guess is that I would have to split the actions for the middleware to remain untouched and then try to keep the structure of the reducers as it is. What is your opinion ?
While thanking you again,
Im not able to perform delete action in store because no id
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.