Earlier quoted context omitted.
Well because the UI isn't just a function of state, it's also a function of those actions (the actions have to literally be passed in to the rendering function). So there's bi-directional coupling between the UI code and the Store (the UI code renders from the state, and passes messages back to the store). Also, conceptually, you often have a lot of state that's very directly concerned with and specific to the UI, an…
I've seen this idea a lot from members of my team that when you use a state management library then absolutely everything has to go through that state management library. This results in some of that pain you describe with state that's specific to the UI. If you're still working with React, try keeping that menu or input state in the component with setState instead of putting it in the global state store. I've found…
Vue.js: the good, the meh, and the ugly
191–200 of 382 posts
Re: Vue.js: the good, the meh, and the ugly
#192>To answer to my initial question: API logic should not be written in Vuex nor in components. There is even a good example on how do that in some of the official code examples. Ok, but where's an example that shows how this backfires? Why should the API logic not be written in Vuex? One more thing I think deserves mention: Vuetify - Vue's material design component set. It's being used in the project I'm currently in…
> Ok, but where's an example that shows how this backfires? Why should the API logic not be written in Vuex? (Author here. I didn't really expand on that because the article was getting pretty long already.) For example, think about authentication logic. It involves more than just calling the API. Eg: extracting the JWT, saving it to localStorage, decoding it, maybe checking user roles, etc. If you do that kind of lo…
It then has some getters which just get the state from the store, but the actions call to a separate module which manages storing it in LocalStorage or making the http requests.
Works for me, but I just took what I learned (Vue) moved it to when I learned a year later (Vuex), when things became complicated in Vuex I just moved the complicated bits back 1 bit more and everything became simple again (which seemed like the logical thing to do).
Re: Vue.js: the good, the meh, and the ugly
#193One of the best arguments against Vue is typescript support. React has really good support for it, even for the state libs like Mobx/Redux etc. Until they turn that around it will be hard for any frontend application to scale properly. I think Vue is great for smaller projects and would absolutely recommend it.
Vue 3 they are moving to TypeScript:
> Will be using TypeScript. For internal implementation only. Does NOT affect ES users, but should improve TS integration for TS users.
Re: Vue.js: the good, the meh, and the ugly
#194Earlier quoted context omitted.
Sorry, you are correct, I made that assumption. It seemed implied by your use of user complaints as a metric of success—I assumed that was the case because you didn't have hard data, so I apologize if that's not the case.
Not a problem at all. I place high value on being available to users of my website. I reply to each and every message. Perhaps it's a bit unusual for someone to talk about that before the numbers. It has been my experience that I've gained more valuable insight from talking with users than I have from the numbers. But, as a little Latina girl once said, why not both?
Re: Vue.js: the good, the meh, and the ugly
#195Re: Vue.js: the good, the meh, and the ugly
#196Earlier quoted context omitted.
Not a problem at all. I place high value on being available to users of my website. I reply to each and every message. Perhaps it's a bit unusual for someone to talk about that before the numbers. It has been my experience that I've gained more valuable insight from talking with users than I have from the numbers. But, as a little Latina girl once said, why not both?
I think the other person was talking about quantitative data (e.g. from Google Analytics), not qualitative data from customer conversations / complaints.
Re: Vue.js: the good, the meh, and the ugly
#197Earlier quoted context omitted.
This is all absolutely true! Redux and React-Redux, and their associated documentation make a lot of intelligent design tradeoffs that have a lot of thought put into them, and that's worthy of respect. "Overengineered" was too strong a term, and I shouldn't have used it. Sorry. However, some of the things that have been traded are default configuration that represents typical use, standardisation across the ecosystem…
Yeah, for a while it seemed like there was a new Redux side effects lib coming out every week. At this point, though, it's pretty much standardized on thunks for basic use cases, and either sagas or observables for more advanced use cases based on your preference of writing async logic. > What I've taken to doing is exporting a dispatch function that calls the store's dispatch, not the store. Not sure I follow that t…
Something like
const store = createStore(...)
export const dispatch = (action) => store.dispatch(action)
It removes the temptation to read directly from the store.> `redux` and `react-redux` are deliberately separate packages
Yeah, my bad, got the import wrong.
> ...limits the reusability of your logic...
When would this become a problem, in practice? Reusable actions across different react/react-native UI, or multiple apps? Switching between user accounts? How common a use case is it?
Even if this is a constraint, I'm of two minds about whether a hack in isolation is worse than more complicated action boilerplate in general.
> ...and also makes it a lot harder to test...
This can be mitigated by Jest's mocks.
> https://github.com/markerikson/redux-starter-kit
That's really good. Unfortunately, it's not the same thing as bundling it with Redux proper.
Anyway, thanks for engaging with me. I never intended to do a deep dive into Redux's design, only to sympathise with stupidcar's comments about third-party state management, but it's interesting to hear the perspective of a maintainer.
Re: Vue.js: the good, the meh, and the ugly
#198Re: Vue.js: the good, the meh, and the ugly
#199I really like a lot of things about Vue. I was apprehensive about using JSX when I first started using React, and I also did not like setState. I think the real issue, though, was that I wasn't thinking functionally. I now rarely write a stateful component, and when I do, it's usually once, for the entire application, or maybe for a few large subtrees if the app is very large. State kept alive by parameters is extrem…
React is just JavaScript and HTML.
Re: Vue.js: the good, the meh, and the ugly
#200Earlier quoted context omitted.
There's unfortunately a thin line between cargo-culting and attempting to follow the mainstream. As developers we can't all be building tools. We choose tools that others build for us, so that we can get our job done. Soemtimes I'm interested in going "one layer down" and build tools, but it's almost always a distraction; we want off-the-shelf products like React and Redux. We need to pick stable tools that promise s…
But if you looked at the official React docs the answer was always 'setState' and embracing components, that was the whole promise of React to begin with. Not once did the React team/docs ever say you needed Flux to build a React app. All of those answers you got were cargo-culted from the community. Can you really look at where the community is, the perception that still exists that React+Redux is necessary, project…