@cirosantilli/_file/nodejs/next/nodejs/next/ref-twice by Ciro Santilli 34 Updated +Created
This is a minimal reproducible example for the terrible problem of external effects applying twice to refs for effects that are not idempotent and thus blowup if applied twice.
The issue is currently discussed at: react.dev/learn/synchronizing-with-effects#step-3-add-cleanup-if-needed (archive) which says "you need to cleanup the thing yourself". web.archive.org/web/20240720100401/https://react.dev/learn/synchronizing-with-effects#subscribing-to-events is also says that for the specific case of addEventListener.
But that's annoying! Can't we just somehow tell if we applied twice or not to avoid having to implement a cleanup? What if a third party system does not provide a cleanup at all?
Is the correct solution to just just have a useEffect with empty dependency list? Seems to be good according to posts and to ESLint!
Tried to do a React only reproduction at: react/ref-twice.html.
@cirosantilli/_file/nodejs/next/nodejs/next/posts by Ciro Santilli 34 Updated +Created
The goal of this example is to understand when states and effects happen when changing between different routes that use the same component.
Behavior is follows:
This is likely because in React the state kept in the virtual DOM structure, and identical structure implies identical state. So when we change from post 1 to 2, we still have a Post object, and state is unchanged.
Next if we click:
then the count is back to 0. This is because we changed the Post object in the DOM to Index and back, which resets everything.
This example also illustrates how to prevent this from happening with useEffect.
@cirosantilli/_file/react/react/ref-twice.html by Ciro Santilli 34 Updated +Created
Failed attempt at minimizing nodejs/next/ref-twice outside of Next.js.
Tempo Rei (documentary) by Ciro Santilli 34 Updated +Created
Very good documentary!
This is a documentary about Gilberto Gil going back to his homelnd for the first time since he emigrated to Salvador/Rio, with some of his most popular songs intermixed into it. Beautiful!
"Tempo Rei" is the name of a Song composed by Gilberto Gil.
Video 1.
Tempo Rei documentary
. Source.
Semantic triple HOWTO by Ciro Santilli 34 Updated +Created
React DOM manipulation by Ciro Santilli 34 Updated +Created
Web Ontology Language by Ciro Santilli 34 Updated +Created
Reasonable introduction: www.w3.org/TR/owl2-primer/
Example: rdf/vcard.ttl.
Implemented by:
LANL PF-4 by Ciro Santilli 34 Updated +Created
ESLint by Ciro Santilli 34 Updated +Created
Gilberto Gil bibliography by Ciro Santilli 34 Updated +Created
Speech synthesis by Ciro Santilli 34 Updated +Created
Kernel space by Ciro Santilli 34 Updated +Created
User space by Ciro Santilli 34 Updated +Created
Neutron moderation by Ciro Santilli 34 Updated +Created
Neutrino emission on Earth by Ciro Santilli 34 Updated +Created
Because they interact weakly with matter and mostly just escape out of nuclear reactors, you can likely locate all nuclear reactors on Earth by measuring neutrino flows:The CIA must love that shit, they must have had it years prior to this public paper.
Safe Sign Technologies by Ciro Santilli 34 Updated +Created
JavaScript linter by Ciro Santilli 34 Updated +Created
Pinned article: ourbigbook/introduction-to-the-ourbigbook-project
Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
Video 1.
Intro to OurBigBook
. Source.
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
    Video 2.
    OurBigBook Web topics demo
    . Source.
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    • to OurBigBook.com to get awesome multi-user features like topics and likes
    • as HTML files to a static website, which you can host yourself for free on many external providers like GitHub Pages, and remain in full control
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 5. . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
    Video 4.
    OurBigBook Visual Studio Code extension editing and navigation demo
    . Source.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact