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
1
2
3
4
5
submitted 1 month ago by zamithal to c/react
 
 

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
 
 

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

Hi all,

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

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

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
18
10
submitted 11 months ago by [email protected] to c/react
19
 
 

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!

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

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

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

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.

24
25
view more: next ›