4 ms·
Yes, React
by jckahn 11mo ago
Yes, React
- iammrpayments 11mo agoWhy would anyone use this outdated code over useInsertRow() and useTableColumnEffect()?
- NetMageSCW 11mo agoWhat are those and where are they in standard Javascript / DOM API?
- zkmon 11mo agoAnd what does that use internally to manage tables? Just because there is layer between you and the API, it doesn't mean API is abandoned.
- __jonas 11mo agoAre you implying that when doing DOM reconciliation, React uses these table-specific insertRow/insertCell APIs for adding and removing elements in tables instead of the regular DOM element APIs it would use for all other elements? I would be surprised if that's the case.
- mpeg 11mo agoThe funny thing is the insertRow/insertCell API just call into DOM manipulation functions like appendChild internally, they just provide some syntactic sugar around things like managing the rows/cells array. It's all the same https://github.com/WebKit/WebKit/blob/28fa568972a4d34d867948618adb4f4cc5532061/Source/WebCore/html/HTMLTableRowElement.cpp#L117-L134 https://github.com/WebKit/WebKit/blob/28fa568972a4d34d867948...
- embedding-shape 11mo agoWhy would it matter what library you use? I'm using React, I do <table> whenever I need to display tabular data, React or no React as no impact on when I'd use <table>.
- iammrpayments 11mo agoJust make sure to pass a subscriber to useSyncExternalStore if you decide to venture outside React and use HTMLTable.insertRow, you see react is really smart and won’t let you use this piece of outdated code without punishing you with side effects. Thanks Vercel & Meta for protecting us.
- embedding-shape 11mo ago> Just make sure to pass a subscriber to useSyncExternalStore if you decide to venture outside React and use HTMLTable.insertRow, you see react is really smart and won’t let you use this piece of outdated code without punishing you with side effects. Huh? Why'd you involve state in this or any imperative code? You render the rows/columns as you'd render any other DOM elements in React, pass in the data as props and iterate on it, create children and pass them to render.
- withinboredom 11mo agoInsertRow updates the live DOM and React just wholesale replaces it. It’s a masterstroke footgun.
- embedding-shape 11mo agoYes, your point? Anyone who spend 15 minutes learning about React learns that you don't manipulate the DOM directly, you let the rendering engine handle that for you.
- iammrpayments 11mo agoYes that’s why of instead of learning the standard apis, you have to spend 15 months learning how to debug useEffect
- embedding-shape 11mo ago
- moritzwarhier 11mo agoReact is as orthogonal to DOM manipulation API as it is to letting the browser render tables from HTML.