@realJSOP said in Global Variables rather than context:
I tried to up-vote your answer, but it looks like they've disabled that for now.
Thanks ... early days...
@realJSOP said in Global Variables rather than context:
I tried to up-vote your answer, but it looks like they've disabled that for now.
Thanks ... early days...
@realJSOP said in Global Variables rather than context:
well, zustand seems to work pretty well. I'm using the createSelectors paradigm and it's pretty easy to understand and use.
Glad to hear! I agree, it is far better and more flexible!
@realJSOP said in Global Variables rather than context:
I thought all state changes caused re-renders.
Zustand does cause UI updates in React, but only for the components that subscribe to the part of the store that changed.
Here’s how it works:
useStore((state) => state.someValue)
, your component subscribes to someValue.Example:
import create from "zustand";
const useStore = create((set) => ({
count: 0,
increment: () => set((state) => ({ count: state.count + 1 })),
}));
function Counter() {
const count = useStore((state) => state.count);
const increment = useStore((state) => state.increment);
return (
<button onClick={increment}>
Count: {count}
</button>
);
}
So... Zustand doesn’t trigger a global re-render like a context provider might. It’s selective and efficient.
@User-10147035 said in How to use FastReport .frx file in .NET WinUI3 App?:
ms.Position = 0;
Before resetting the position, have you set a breakpoint to check that the stream has data? ie:Position > 0
?
@sneha2004sahani2004 said in Is this the correct category for Blazor Server questions:
Most forums lump Blazor Server and Blazor WASM together
Hmmm, there are more than two... Blazor Server Static, Blazor Server Interactive, Blazor WebAssembly/WASM, Blazor Auto (Server + WASM), Blazor Hybrid (WinForm, WPF, Analonia, MAUI) ... Then there is StreamRendering...
@realJSOP said in AI Coding Is Not a "Good Thing (tm)".:
I'm talking about the act of using AI to write code and its implications on the general skill level of people that think AI code generators are reasonable and suitable.
The sample code given is for a chat with AI, not AI writing code.
@realJSOP said in Global Variables rather than context:
Since contexts (and Zustand) just appear to be wrappers around state variables (which cause re-renders when changed)
Zustand sits outside of the state, so it doesn't directly cause rerenders.
@realJSOP said in AI Coding Is Not a "Good Thing (tm)".:
What say you?
It's like any tool, garbage in = garbage out.
@realJSOP said in Zustand State Manager - real-world examples:
I'm old - I don't use AI to write code.
You miss the point that I was making. It's not about the AI, it's a real-life example of how it can be used.
@pkfox said in I signed up for Anthropic's Claude model - might go with Kagi's Claude next. Some observations:
Hi HTCW, I recently used ChatGP to help me to convert/rewrite an MVC site to Blazor Server and I must say it was very helpful but as you say you have to watch what it gives you carefully - if you tell it exactly what you don't want it actually will improve its offerings - nice to see old names appearing here
I've spent several weeks experimenting with AI vibe coding and have learned that it is good a small tasks but can't keep focus on larger tasks. You can constrain it through tracking and guidance documents (microsoft vs & vs code call them copilot-instructions.txt). The current issue is 2 fold:
So here is an example with Claude Sonnet 4, the best of the AI models at the moment: I have a library that I wrote recently called Blazing.Mediator. I used the docs as a guide that I gave to the AI. Everything starts well. However, if I let it run for a while and there is one or more summarisations, Claude switches to coding MediatR patterns. Overly opinionated! Then there is the cost...
I find that I spend a lot of time cleaning up after the AI and lose any gains made if I let it loose on my code, adding new features.
I now keep it to simple or repetitive tasks - wire-framing, prototyping, initial UI, comments, converting code, fixing errors/warnings, rubber ducking, etc... There are some things that it can do quicker than you without giving you work.
Yeah, I noticed the same ... Remember Me is missing.
@realJSOP said in Zustand State Manager - real-world examples:
I've watched a couple of videos, but they are very simple examples whose most complicated sample is incrementing/decrementing a counter. Dose anyone have a real-world use case taht can comment on it's functionality?
Sure. How about the openai-responses-starter-app from OpenAI? Here is one example: useConversationStore.ts
I'm currently working on a React (v19) project, and my desktop programmer brain is fighting it. We make extensive use of tables (material-table/core) and custom inputs and I'm currently working at home on a version that makes substantially less use of useStates because they clobber rendering performance. I've managed to duplicate about 90% of our infrastructure and reduced the # of useStates from over 550 to just 47 instances.
I'm like you with React. Have you looked at Zustand. I only use useState
if I have to.
raddevus wrote:
I've begun the (painful) work to save all of my CP articles to my local drive.
All of my articles are written in Markdown, except for a few early ones, all written locally before uploading. I've done this as I've had a bad experience years ago with PlanetSourceCode....
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
Mike Hankey wrote:
I've been with CP for over 20 years
Same...
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
Marc Clifton wrote:
Though I agree, it would be nice to hear from the new leadership as to the future of CP.
100% agree ...
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
Is there any point if the lights are on and nobody is home running the show?
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
Yes ... it's the lights slowly turning off...
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
Work and family have kept me busy, but I try to find time to visit and volunteer as a long-time member. Last night, in the early hours, my wife's sister passed away. Only tonight I logged in and saw the news. It's like last night all over again. This is not the first coding site that I have seen this happen to and it won't be the last. I hope the service lives on under new management or is spun off into a new community site. I will miss everyone.
Graeme
"I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee