1
1
submitted 1 month ago by [email protected] to c/[email protected]
2
2
submitted 1 month ago by [email protected] to c/[email protected]
3
4
submitted 2 months ago by [email protected] to c/[email protected]
4
5
Count child elements HOC (programming.dev)
submitted 2 months ago by [email protected] to c/[email protected]

I'm looking to write an HOC that counts and prints to the console the number of elements in the wrapped component. For example:

const Foo: FC<{}> = ({}) => {
    return (
        <div>
            <h1>Foo</h1>
            <p>Bar</p>
        </div>
    )
}


export default countH1(Foo)

this should print 1 and then return Foo as is for rendering.

React.Children.forEach(child => {...})

seems to be about the explicit children property and not descendant html elements. How can I achieve this?

5
-1
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/[email protected]

First off, I've been loving vanilla-extract for the past 10 months. 😊

The only thing I really missed was the ability to sort CSS properties. Since there wasn't an ESLint plugin for that, I decided to create my own.

@antebudimir/eslint-plugin-vanilla-extract offers CSS property ordering (alphabetical, concentric, and custom), auto-fix capabilities, and supports multiple Vanilla Extract APIs.

If anyone wants to give it a shot, you can find more details in the readme. Looking forward to hearing your feedback.

6
11
submitted 3 months ago by [email protected] to c/[email protected]
7
10
React v19 (react.dev)
submitted 5 months ago by [email protected] to c/[email protected]
8
2
submitted 6 months ago by [email protected] to c/[email protected]
9
3
Chakra UI: Announcing v3 (www.chakra-ui.com)
submitted 7 months ago by [email protected] to c/[email protected]
10
8
submitted 7 months ago by [email protected] to c/[email protected]
11
-5
submitted 7 months ago by [email protected] to c/[email protected]
12
4
submitted 8 months ago* (last edited 8 months ago) by [email protected] to c/[email protected]

Hi all,

This is my first time posting my blog, I hope you enjoy it!

13
8
submitted 9 months ago by [email protected] to c/[email protected]
14
-9
submitted 9 months ago by [email protected] to c/[email protected]
15
8
State of React 2023 survey results (2023.stateofreact.com)
submitted 10 months ago by [email protected] to c/[email protected]
16
0
submitted 10 months ago by [email protected] to c/[email protected]

The article mentions Next.js but it also applies to vanilla React as the sizes attribute is useful even outside Next's <Image> component.

17
11
submitted 1 year ago by [email protected] to c/[email protected]
18
10
submitted 1 year ago by [email protected] to c/[email protected]
19
0
submitted 1 year ago by [email protected] to c/[email protected]
20
-7
submitted 1 year ago by [email protected] to c/[email protected]

Hi there,

I have written an article on implementing server-side caching that ensures your app stays fast as you scale.

I’ve used ExpressJS for the API server, and React for the frontend.

Hope this helps someone!

21
5
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]

I stumbled upon this project on GitHub and figured it might be of interest to some people here

22
11
submitted 1 year ago by [email protected] to c/[email protected]
23
-2
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
24
8
submitted 1 year ago by [email protected] to c/[email protected]

I have a custom hook that I'm working on to make a fetch request to an api, and it is causing infinite re-renders. I'm struggling a bit to understand how the various parts of my application fit together -- in particular, my store (zustand) is using a middleware (immer) for immutable state, and I'm not certain why its drafting system isn't protecting me from changes in object identity. What tools can I use to try to track down what I've gotten wrong? I can't really leave the web page open very long because I'm making 1000s of requests per minute to the api I'm working against, so the Chrome dev tools are out, and the static analysis tools I set up (typescript and eslint) haven't identified any errors, like missing a dependency from the useEffect hook dependency array.

25
5
submitted 1 year ago by [email protected] to c/[email protected]
view more: next ›

React

1104 readers
1 users here now

A community for discussing anything related to the React UI framework and it's ecosystem.

https://react.dev/

Wormhole

[email protected]

Icon base by Skoll under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS