React

1082 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
 
 

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?

3
 
 

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.

4
5
6
7
8
9
 
 
10
2
submitted 7 months ago* (last edited 7 months ago) by [email protected] to c/[email protected]
 
 

Hi all,

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

11
12
13
14
 
 

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

15
16
17
18
 
 

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!

19
 
 

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

20
21
22
 
 

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.

23
24
25
 
 

Firereact is hooks, component and utilities library for Firebase and React.

Features

  • Very lightweight, unpacked size when unpacked, npm min bundle size when minified, npm minzip bundle size when minified+gzipped
  • Supports Auth, Firestore, Functions, Providers and Storage.
  • Provides hooks such as useUser for Auth or useDocument for Firestore, which can listen to realtime changes as well
  • Provides custom components such as <FirestoreDocument /> or <StorageDownloadLink /> to keep the logic simple and/or avoid unnecessary rerendering
  • Provides Providers such as FirebaseSuiteProvider, FirebaseAuthProvider or FirestoreProvider to access Firebase service instances anywhere in the component tree without relying on global variables or prop-drilling
  • Comprehensive documentation
view more: next ›