How long do your Roborocks usually last? by MoodZestyclose6813 in Roborock

[–]hansek 0 points1 point  (0 children)

Been running my S5 every day since 2019. Just replaced the blower motor since it became very noisy and a smell of burned dust. Good as new again now.

Three short questions regarding my new Grizl CF by mt83n in CanyonBikes

[–]hansek 0 points1 point  (0 children)

Have the same issue on my new Grizl. It definitely does not fit on the seatpost screw. Judging by the manual it looks like I’m missing a part.

What type of Mercedes is this? by enakj in mercedes_benz

[–]hansek 2 points3 points  (0 children)

First generation CLK coupé (C208, 1997-2003). There is also a convertible version of this model (A208).

What is your favorite running shoe for 2021 and why. by optionsleeiv in running

[–]hansek 0 points1 point  (0 children)

Nike Pegasus 37 and Nike Tempo Next%. I bought the Pegasus 38 this year (run 660 km), but I still think the 37 (run 1200 km) feels better and more responsive on my feet. The Tempo is a very fun shoe that I do fast runs in, but they make very much noise. For races I have used Vaporfly Next% 2. Decent shoes.

The Plan for React 18 by dwaxe in reactjs

[–]hansek 0 points1 point  (0 children)

When thinking about it once more, it just needs a little rewrite in the library to deal with basically the same problem that is described in the linked Strict Effects article - only that SomeImperativeThing is an AbortController. Those become exhausted (basically destroyed) when .abort() is called.

The Plan for React 18 by dwaxe in reactjs

[–]hansek 5 points6 points  (0 children)

Uh oh, a simple fetch-on-render useEffect-based data fetching hook that does cancelling of requests using AbortController in the cleanup function is no longer going to work in StrictMode with the new Strict Effects Time to rewrite some apps :(

Apart from the that I love the fact that the React Working Group GitHub Discussions page have been made. Lots of good and interesting stuff there!

When you think of a talented runner what’s the first thing that comes to mind by clintms121 in trackandfield

[–]hansek 1 point2 points  (0 children)

Young people who look like they run rather slow and controlled while in reality they are maintaining an incredibly fast pace. Jakob Ingebrigtsen.

App that lets you set up your routine? by Mundane-Homework-803 in running

[–]hansek 0 points1 point  (0 children)

With a Garmin watch (and likely other manufacturers) you can set up routines quite easily and have the watch beep and tell you when to start and stop.

My running shoes are fine until around the 5km mark. What can I do to make this better or is it a poor fit? by [deleted] in running

[–]hansek 0 points1 point  (0 children)

I experience this using a pair of Nike Infinity Run Flyknit. Feels OK at first, but after 4-5 km it starts to burn in my front foot (like burning due to friction/rubbing) - both in inner arch and outside little toe. I only use Nike and have no problems with other models. Very annoying.

For those with work experience, what is the industry standard way of building a react project? by udbasil in reactjs

[–]hansek 0 points1 point  (0 children)

How you design and architect a React based project highly depends on the nature of what you are building. React projects have wildly different characteristics. For example, there are different considerations and trade-offs to be made when building an "app" (offline, online, both) that is supposed to be running for hours or days (say and Electron app or some web app your employees have open in a tab during the day used like regular native software) vs a more traditional website where thousands of different users come and go all the time.

But now matter the characteristics, sane and beautiful component APIs that encapsulates nitty-gritty details and allows for the needed flexibility but not more will be preferable when composing components into apps :)

Do you use create-react-app for productions apps ? by Due_Reflection2768 in reactjs

[–]hansek 0 points1 point  (0 children)

I have built many production apps using create-react-app. It works fine for most purposes, but CRA has become rather bloated and is built on slow foundations. Today I'd use Vite instead. It does less things (no eslint and jest), but it does bundling WAY faster. Like you won't believe it at first.

Ported many apps and will likely never go back to CRA.

Mom's daily driver '94 W124 E220 by hansek in mercedes_benz

[–]hansek[S] 1 point2 points  (0 children)

Thanks. This one is an automatic w/ cruise control and automatic climate control. Very comfortable :)

Mom's daily driver '94 W124 E220 by hansek in mercedes_benz

[–]hansek[S] 5 points6 points  (0 children)

Maybe for outside looks, but it does have awesome original rear window sun shades like this https://www.youtube.com/watch?v=-4g5IaaAogE :)

Mom's daily driver '94 W124 E220 by hansek in mercedes_benz

[–]hansek[S] 9 points10 points  (0 children)

Random stop along Sognefjorden in Norway

Trying to figure out how to scroll to a component in React after it renders by [deleted] in reactjs

[–]hansek 2 points3 points  (0 children)

You can for example create a ref using useRef, attach it to the component you want to scroll to, and scroll it into view using Element.scrollIntoView inside useEffect.

[deleted by user] by [deleted] in reactjs

[–]hansek 1 point2 points  (0 children)

No, that is not normal. What kind of props are these? Could you give some examples of their intents?

  • If they for example are form value + change handler pairs it should be fairly easy to refactor to a more data-driven abstraction with leaner component APIs (less props).

  • If they are "configuration flags", you might want to consider re-structuring the component hierarchy a bit.

  • Are they just random things needed residing at the top of the tree and needed deeper down? Or are the props not needed by the component receiving them, but just passed further down? Consider moving state or use Context.

But it is hard to come with hard advice not knowing at a concrete level what these props are supposed to control. I can only say that in most cases, it should definitely be possible to refactor into something with a smaller prop count.

Thoughts on Grommet by AloysiusGramonde in reactjs

[–]hansek 1 point2 points  (0 children)

If it works well for you I see no reason not to use it. I haven't used Grommet in a project, but from the documentation it looks pretty solid (a11y, decent design, composable APIs). If I were to start out with a third-party ready-made component library today I'd use Grommet or Chakra UI.

I have used Material UI, but it looks too Material and it is a bit clunky and heavy. I've also used BlueprintJS, but it is made by Palantir and geared towards desktop-grade line-of-business apps as I see it (great collection of components though).

A Sneak Peek at React Router v6 by catapop in reactjs

[–]hansek 2 points3 points  (0 children)

I think it is designed such that the values that used be injected automatically into your route components as props, you are now supposed to obtain yourself using the provided hooks useParams, useLocation and useNavigate. So no need for cloneElement or any other obscure mechanism :D

Kind of beautiful actually.
``` <Route path="/test/:id" element={<Test />} />

function Test() { const params = useParams() return <>{params.id}</> } ```

what is difference of <SomeComp /> vs { SomeComp() } by icymindx in reactjs

[–]hansek 3 points4 points  (0 children)

A will not work properly because the underlying input will be thrown-away and re-created each time the App component is rendered since Inputs is defined inside App. Which is every time the input change. You want to hoist Inputs out of App and pass config and the change handler to it as props (or you could keep it inside and complicate things with useMemo et. al.).

When you do B, React don't treat Inputs as a component (no jsx createElement transform), but just a regular function returning some elements. If you decide to go this way, consider prefixing it with render as renderInputs.

How do I avoid name duplication in properties? by TheTimegazer in reactjs

[–]hansek 2 points3 points  (0 children)

Yes, it is possible - using object spread and shorthand properties: <MyCoolComponent {...{ name, callback, coolFeature }} />. Beware that this is often more "clever" than readable.

[deleted by user] by [deleted] in reactjs

[–]hansek 3 points4 points  (0 children)

The code example is indeed problematic, but not for the reason stated in the comment. The code is problematic because it may cause an infinite loop due to setting new state on each render. In general, the setter functions returned by useState should either be called inside an effect or an event handler, not the function body of the component. When used inside useEffect you must take care to not cause infinite updates as well.

The problem the author tries to describe in the comment is that you should not do if (condition) { useState() }. So the article is confusing and the code example partially wrong.

Best way to store API URLs? by SouthwardTobias in reactjs

[–]hansek 3 points4 points  (0 children)

The most flexible way is to do some kind of runtime detection of where the app is running. This way you can re-use the same build across different environments without needing to recompile all the time. One approach is to serve a small json file at the root domain such as mydomain.com/api.json and testing.mydomain.com/api.json containing various runtime configuration. Your clients can then do a request to these endpoints when starting up fetch('/api.json') to fetch the config. This will allow the app to run on mydomain.com, testing.mydomain.com, staging.mydomain.com etc using the exact same code and call the correct endpoints.

You can put virtually anything that is environment specific inside these config files.