question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data-reactid alternative.

See original GitHub issue

I know 0.15.0 no longer uses keys in data-reactids which is part of my issue however I’d like to bring forward a different way to link the dom for the initial render which is to keep text nodes and regular nodes separate.

I have implemented something like this in my own simple virtual dom here https://github.com/DylanPiercey/tusk/blob/master/lib/virtual/node.js#L80 and here https://github.com/DylanPiercey/tusk/blob/master/lib/virtual/text.js#L37

I am not sure if react works this way at all but essentially it recursively mounts nodes from the top down and splits up text nodes using splitText to ensure that the server produced dom matches the virtual structure.

Just curious if something like this is feasible in react since it has allowed me to implement bootstrapping server side code while producing clean html output without checksums or ids.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
gaearoncommented, Apr 1, 2016

Would you be interested in creating a proof of concept of this in React?

1reaction
awearycommented, Oct 3, 2016

Currently React doesn’t provide such possibilty: it only can render the whole thing one at a time, guarding it with data-reactids and data-react-checksums. I guess someone will eventually develop such a mixed caching solution, and probably that could be a big company that hits performance issues while rendering React on the server-side.

You might want to check out react-dom-stream, which does some caching with SSR

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing data-reactroot attirbute in React 16 - Stack Overflow
Notice I'm talking about data-reactroot not data-reactid and I'm upgrading to React 16, not React 15. – ecc. Nov 9, 2017 at 13:41....
Read more >
Introduction to the data-reactid Attribute in HTML | Pluralsight
HTML allows custom data attributes, and one such attribute is data-reactid, which helps you uniquely identify components within the DOM tree ...
Read more >
data-reactid going away in v15! : r/reactjs - Reddit
Yes, I looked into that. It communicates with React via an API instead of looking at the DOM. That makes sense as it...
Read more >
[attribute] | CSS-Tricks
There are lots of ways you can select elements in CSS. The most basic selection is by tag name, like p { }....
Read more >
React, JSX and ES6: The Weird Parts - Ponyfoo
<span data-reactid=".1gm29bnrabk.1.0"> <span ... In general I've been taking the approach of defaulting to the ES5 alternative, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found