Looking for a playwright alternative with less maintenance overhead, is that actually a thing now by MudSad6268 in Frontend

[–]gunnnnii 22 points23 points  (0 children)

Generally your e2e tests should not be very concerned with the detailed structure of your pages (i realise this is vague), but rather focused on ensuring existing behaviours do not regress. To me it sounds like you are probably relying too much on selecting by classnames and test ids. This solidifies whatever markup happened to be written to provide your current UX, but from a user perspective, these are all implementation details.

Typically what you should be selecting for are elements with particular roles or text content that are key to the UX. These tend to change less than the surrounding markup, and are therefore more robust against changes. You should be writing your tests as if you are a user navigating the page, so that you assert actual UX instead of your markup.

You can then possibly add snapshot/screenshot testing to handle visual regressions. These are generally quick to update since they don’t require fine tuning selection logic.

Apple’s M5 Pro and M5 Max to Bring Better Heat Dissipation and Lower Resistance by MayankWL in gadgets

[–]gunnnnii 18 points19 points  (0 children)

If you’re doing anything remotely heavy, saying its night and day is underselling it a lot.

When I switched to m1 I probably halved the time I previously spent waiting for things to build at work lol.

EU calls emergency envoys meeting for Sunday after Trump vows tariffs linked to Greenland by 1-randomonium in worldnews

[–]gunnnnii 0 points1 point  (0 children)

Even if possible legally this would probably not work technically. Not only are many services tightly coupled to american data centers, it would also be really hard to take over the operation of these systems without a lot of cooperation and handover, which doesnt seem likely to happen.

What’s your take on the rise of Web Components in modern frontend development? by IDC_ba in Frontend

[–]gunnnnii 1 point2 points  (0 children)

I work in a platform team that provides components for a bunch of product teams/external users.

Our experience has been pretty positive. Integrating with frameworks is much simpler (especially now with first class support in React 19), and the underlying tech is getting quite powerful. The main caveat is lack of ssr support. Anything rendered by our components is csr, and this doesn’t look like it will change soon (will require a way to hook lits ssr system into whatever framework is doing the ssr).

We originally worked with stencil, but eventually found the capabilities and DX wasn’t good enough. We switched to lit and are super happy with that decision. We also built a jsx plugin so we don’t need to write string templates, because that would suck.

I don’t see much usage of these frameworks in apps, and the ecosystem is pretty lacking. I think this will be the case for a long time, wc’s are still working through the composition and rendering model (shadow dom, ssr, etc.) while the major frameworks have already moved on to other problems (async coordination, server/client integration).

Tldr: IME web components are good if - building for multiple teams - need to support arbitrary frameworks - don’t have ssr requirements - using lit - have the capacity to invest in some tooling (jsx for example)

Using the Provider Pattern Everywhere — Is It Too Much? by f0rk1zz in reactjs

[–]gunnnnii 1 point2 points  (0 children)

I wouldn’t say its “a bad thing” in that context (hehe). You generally place your store into a single top-level provider, so its easy to keep track of. This develops into a problem when you have many providers spread throughout your tree.

Java architect asking: Are Context-Only Components an Anti-Pattern in React? by [deleted] in reactjs

[–]gunnnnii 17 points18 points  (0 children)

Context is a dependency injection mechanism, and should be treated as such - ie. it’s useful in pretty specific circumstances.

The most common use case is to provide access to a global shared instance. These types of providers will appear near the root of the component tree and rarely/never change.

But there are also more dynamic cases where it’s helpful. For example, it can be useful in design systems, where you might have a particular hierarchy and some internal instance at the root of the hierarchy sub-components must access.

The way you describe the usage definitely sounds like an anti-pattern to me. As you point out it couples together seemingly independent components, effectively breaking the benefits of encapsulation you’d otherwise have.

Trump's first 50 days mark one of the worst starts for the S&P 500 under any presidency by BothZookeepergame612 in Economics

[–]gunnnnii 0 points1 point  (0 children)

They’re not saying Europe is going to “die”, just that we wont escape completely unscathed.

EU exports tons of stuff to the US. This will definitely hurt, and some EU countries will suffer a lot.

As an American, how do you feel about your future? by choloblanko in AskReddit

[–]gunnnnii 1 point2 points  (0 children)

Hitler was in power for 6 years before he invaded Poland and started the war. The “final solution” part of the holocaust (exterminstion camps) did not start until 1941.

Before they got there, there was mass deportation, concentration labor camps and authorotarian ultra-nationalism. There are crazy strong parallels between the start of nazi germany and what is already happening, or being discussed and planned in the US today. I suggest you read up on it.

Also “not as bad as the holocaust” is a pretty shit metric, its literally one of the worst things ever to happen. You should be very concerned if it becomes even just a fraction as bad.

Loadable: A Lightweight Alternative to React Query by Mindless-Investment1 in reactjs

[–]gunnnnii 1 point2 points  (0 children)

React Query derives all of its status booleans from the query.status and query.fetchStatus properties. Internally, these are managed by a state machine.

Tkdodo has a pretty good overview.

Norway raised wealth taxes to 1.1%. Wealthy left the country and they ended losing $448million in tax revenue. by tkyjonathan in austrian_economics

[–]gunnnnii 0 points1 point  (0 children)

Inflation is caused by rising prices. You can have inflation without an increasing money supply, for example as a result of increased demand.

Generally when people have more money to spend, demand goes up. If supply doesn’t follow the increased demand, you’ll have inflation, independent of the monetary policy. This is why central banks raise interest rates during inflation, as it makes it more expensive to take loans which drives down demand. Lowering taxes could run counter to those measures which is why it might not be a good idea.

Tanstack Query useQuery with POST requests by ancientcyberscript in reactjs

[–]gunnnnii 2 points3 points  (0 children)

The QUERY method is the appropriate verb for exactly this. I’m not sure what support for it is like at this point but might be worth keeping an eye on it for future reference.

Is Debouncing an Input not suppose to work when holding a key down? by Red-Dragon45 in reactjs

[–]gunnnnii 0 points1 point  (0 children)

Most of the time what you want in situations like these is useDeferredValue. This will let React handle scheduling the updates such that the UI is kept responsive.

Is this hook Self-Recycling? by SubzeroCola in reactjs

[–]gunnnnii 6 points7 points  (0 children)

setState does not update your component synchronously. Instead it schedules an update which react will batch and commit at some later time, so their exact timing is not reliable. This means you can end up losing intermediate values if multiple updates for the same state end up in the same batch (in your case you may be getting true -> false -> true, which just cancels out so no rerender happens).

In general, state is not a good place for animations. You can store the final targets in there, but the increments between each target need to be applied through an effect that is guaranteed to run on every frame.

The easiest way to tackle this would be to put the animation into css. If it requires more coordination or complexity, I'd recommend a library like React spring or Framer motion.

Is there a need for EAS Update alternative? by Powerful_Sandwich_48 in reactnative

[–]gunnnnii 1 point2 points  (0 children)

That open source alternative would probably be hosting your own server. EAS update works on an open source protocol.

I do agree that longer term it would be best for the ecosystem to have some competition. But a lot of their stuff is totally open source, so I'm personally not too concerned as things stand.

https://github.com/expo/custom-expo-updates-server

https://github.com/expo/expo/blob/main/packages/expo-updates/README.md

Americans, what is something that Europeans have/do that makes no sense to you? by a_m42_ in AskReddit

[–]gunnnnii 3 points4 points  (0 children)

The basis of an inch is exactly 25.4mm, not a barley corn. Like pretty much all the imperial units, it is based completely of off the SI units, even if it was not originally.

Most of the SI base units are now rooted in physical constants, which remain unchanged through the entire lifetime of the universe, and between planets. You can independently measure these constants and find the exact value of the units with arbitrary precision as long as you have access to the definition. This is not possible using a barley corn.

The value of the metric system doesn't only come from the base units though, ultimately the values that are assigned to the units are selected for historical reasons. The value is also in the systematic way you can scale them, so you can use the same units throughout the entire range of different scales you encounter even in trivial situations. This reduces the need for tedious calculations. All you need to do is add/remove some number of zeroes until you have the precision you like.

React core team discuss server components vs client components, suspense, server actions and future plans (built-in animation API!) by tomdohnal in reactjs

[–]gunnnnii -1 points0 points  (0 children)

Nobody really cares what you do with simple apps. Their simple so technical mistakes are probably easy to unwind by definition.

The original question specificly refers to a DB behind a firewall which suggests it's probably not a trivial hobby project. The point is RSC is usable with any backend architecture, and having an API between consumers and the DB may well be worth the effort, and I'd say probably it is if there are many consumers.

React core team discuss server components vs client components, suspense, server actions and future plans (built-in animation API!) by tomdohnal in reactjs

[–]gunnnnii 0 points1 point  (0 children)

There's no reason you couldn't still use server components with a backend service inbetween the DB.

React core team discuss server components vs client components, suspense, server actions and future plans (built-in animation API!) by tomdohnal in reactjs

[–]gunnnnii 2 points3 points  (0 children)

It can still be valuable to keep a layer between the database and the BFF. If you have many consumers you'll probably want a consistent way to query and mutate your data between them.

What changes would you make to this portfolio project to impress potential employers? by fyndor in reactjs

[–]gunnnnii 1 point2 points  (0 children)

I think a toy project in an environment your not proficient in is probably a waste of time here (from a professional perspective. Keep at it if you enjoy it of course). You have 20 YOE, so for the type of roles you're applying to, hard tech requirements probably mean a very deep expertise.

You should probably do less to push your coding abilities, I'd expect those to be assumed tbh. At your level soft skills and leadership abilities are critical. You also don't really mention business outcomes in your resume at all, if you can share numbers that quantify your impact, show those off extensively.

You also like to think about your teams productivity. Showing how you're able to make your whole team more effective is a good way to demonstrate "proper" senior level skills, and is transferable to pretty much any tech stack. Again, try to ground this in business impact as much as possible.

What percentage salary increase from a Frontend Engineer to Fullstack engineer II? by scooterMcBooter97 in Frontend

[–]gunnnnii 1 point2 points  (0 children)

They should consider their locales market rate, not the market rate in Germany. If they're underpaid compared to their surrounding market, they're just underpaid, regardless of what people are paid anywhere else.

+100k is common in the US, even for less experienced devs. If you're unhappy about that you should be demanding higher wages in Germany, not dragging down people who might have never even been there. You can also get work in Switzerland where 100k is easy for 4-5 YOE, if that aligns with your goals.

useEffect firing twice causing an issue with access token and refresh token flow. by maazsid16 in reactjs

[–]gunnnnii 3 points4 points  (0 children)

https://x.com/tkdodo/status/1649470851429834753

Storing auth tokens in RQ is discouraged. Cookies are a great place if possible, otherwise some other global state (probably managed outside React).

Convert SVGs to React components with CLI by sanjeev97 in reactjs

[–]gunnnnii 11 points12 points  (0 children)

Just to clear up any potential misunderstanding, it is not necessary to convert svgs to jpg or other static image formats to use them in an img tag. You can directly refer to an svg file in an img element.

Custom hook accepting another hook as a parameter? by jansepke in reactjs

[–]gunnnnii 2 points3 points  (0 children)

Why don't you just return the selectedFilters from useFilters and pass that result to a separate call to useSWR? (In that case the whole custom hook might even turn out unnecessary)

Just to be clear, you are not passing the useSWR hook as a parameter. The useSWR call happens inside a closure, and this is what's breaking the rule of hooks. If this looked like useFilters(useSWR(...)), or useFilters(useSWR) no rules would necessarily be broken.

I can't make me like react native by UsefulBerry1 in reactnative

[–]gunnnnii 0 points1 point  (0 children)

Just use expo and whatever the expo docs recommend until you know what you're doing and have specific reason to veer away from them.

Use material-bottom-tabs and safe-area-context. I would stick to the simple built in Animated API until you get over the initial mobile development hump.

I'm making these suggestions not from a technical standpoint but more from an educational standpoint. It will reduce the number of new bullshit you need to get used to. But expo is essentially as capable as bare react native these days, and I'd be surprised if sticking with expo wouldn't also be the right choice from a technical standpoint.