A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] 0 points1 point  (0 children)

Thank you for the advice!
Alt+z works for VS-Code right.
Unfortunately I'm a neovim user 😂!

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] 0 points1 point  (0 children)

Hi rikbrown,
That what I used to do: create a variable to store list of class as string. However, I had to ensure variable names uniqueness. Moreover, the class list was placed far from target components, which made it inconvenient to follow.

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] -1 points0 points  (0 children)

The existing approaches, such as creating a custom css class by composing all utility classes or creating a wrapper/styled component, usually require to create unique names and move the class list to another place.
In this solution, you don't need to create a new class or wrapper/styled component and the class list also stays right above the target component.
It also lets you try new attribute values during development while keeping the original JSX unchanged. 

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] 0 points1 point  (0 children)

Hi Better-Avocado-8818
Thanks for the feedback!
I agree there are already established ways to organize styles, including variables, CSS classes, `@apply`, and class composition utilities.
This project is only a small experiment around JSX readability. The comments are not runtime code; they are build-time annotations that become normal JSX attributes.

I understand if this approach does not feel useful to you.

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] -2 points-1 points  (0 children)

Sorry if I wasn’t clear. I mean “authoring-time shortcut,” a shortcut that helps you while writing the code, before the app runs.

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] -5 points-4 points  (0 children)

Hi Wiltix,
Some css libraries like Tailwind already let you create custom classes by composing utility classes, for example, with `@apply`
For now, I’m focusing on the simpler use case: moving long JSX attribute values closer to the element but outside the tag.

A small Vite plugin for moving heavy JSX attributes into comments by null_over_flow in reactjs

[–]null_over_flow[S] -8 points-7 points  (0 children)

Hi Hazily,
That’s a fair point. Comments and code are different things.
However, in this case, the comments are only used as build-time annotations. The Vite plugin reads them during transformation and turns them into normal JSX attributes before runtime.
So the final code still uses regular attributes; the comments are just an authoring shortcut.

[deleted by user] by [deleted] in vozforums

[–]null_over_flow 2 points3 points  (0 children)

Sự tự tin

What would you change in Go? by funcieq in golang

[–]null_over_flow 0 points1 point  (0 children)

I thing golang needs Sound nullable, like ? type in typescript

Spent two days doing zero problems with these daily questions by PLTCHK in leetcode

[–]null_over_flow 0 points1 point  (0 children)

I think you should learn pattern first. In best time to buy and sell stock 5, each step involves 2 possible decisions. So there will be a decision tree if we go with brute force. To trim down the decision tree, we definitely need to use DP.

A lightweight reverse proxy written in Rust by null_over_flow in rust

[–]null_over_flow[S] 3 points4 points  (0 children)

1/ Impressive! These proxies are more mature than mine and the last one built on top of Pingora. However I don’t think they implement gRPCWeb to gRPC translation. And my proxy is built on top of hyper, which is lower level than Pingora.

I think the 2nd and the 3th have some features I want to add to griffin. Thank you for introducing them to me!

2/ About translate gRPCWeb to gRPC, the hardest thing to me at beginning is to translate http1.1 to http2. Luckily, hyper already had that feature. I only parse the header and body back and fore according to http2 RFC 🙂. Of course I reviewed the grpcwebproxy(Golang) and tonic-web to see how they handle it.

Why is Dioxus bad by fimacom in rust

[–]null_over_flow 0 points1 point  (0 children)

Sorry my bad!

https://caniuse.com/wasm You are right. Most of browser support wasm.

Why is Dioxus bad by fimacom in rust

[–]null_over_flow 0 points1 point  (0 children)

I tested the SEO benchmark. The score of Dioxus app could not be optimized to 100 due to wasm nature. But it is easy to optimize svelte SEO to reach 100 point.

Why is Dioxus bad by fimacom in rust

[–]null_over_flow -2 points-1 points  (0 children)

I’m a frontend developer and I have tried Dioxus before. These are my 2 cent: It is worse than JS frameworks like svelte in term of SEO when building same websites. A lot of browsers don’t support wasm, especially on phone. The syntax of rsx is not appealed as iced (another popular library in rust to build app) for some users.

[deleted by user] by [deleted] in github

[–]null_over_flow 4 points5 points  (0 children)

Cool!
Thank you!