<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs" -->

---
title: An apparent React bug | daily.dev
description: The details HTML element doesn't work well when used as a controlled component in React. At first, I thought it was a React bug, but at the end of my...
canonical: https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: An apparent React bug | daily.dev
og:description: The details HTML element doesn't work well when used as a controlled component in React. At first, I thought it was a React bug, but at the end of my...
og:url: https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs
og:image: https://api.daily.dev/og/posts/dGVfnNVfS.png
og:image:alt: An apparent React bug
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# An apparent React bug

**[Community Picks](https://daily.dev/sources/community)** · 4 min read · 20 upvotes · 3 comments

## Summary

The details HTML element doesn't work well when used as a controlled component in React. At first, I thought it was a React bug, but at the end of my investigation, I concluded it’s simply a mistake – not having a single source of The onToggleevent listener toggles isOpen, which changes the openattribute – so we’re back to step 2, hence the infinite loop.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://phelipetls.github.io/posts/surprising-react-bug/>

## Community discussion

Top comments from developers on daily.dev.

**@kkurko** · 2 upvotes

> I'm going to repeat comments above, but that's interesting! Lifelong learning is in business

**@ivarrreyna** · 1 upvotes

> Interesting

**@shubham\_kamath** · 1 upvotes

> Interesting read

---

Tags: [#react](https://daily.dev/tags/react), [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"An apparent React bug","url":"https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs"},"datePublished":"2022-09-20T08:27:35.674Z","dateModified":"2023-12-07T12:02:45.284Z","description":"The details HTML element doesn't work well when used as a controlled component in React. At first, I thought it was a React bug, but at the end of my...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6a9b1dfd4ce6371a060ac4fcc5b49255","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6a9b1dfd4ce6371a060ac4fcc5b49255","isAccessibleForFree":true,"articleSection":"Community Picks","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Community Picks","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1655817725/logos/community","url":"https://daily.dev/sources/community"},"commentCount":3,"discussionUrl":"https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":20},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":3}],"keywords":"react,javascript","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Community Picks","item":"https://daily.dev/sources/community"},{"@type":"ListItem","position":3,"name":"An apparent React bug"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/an-apparent-react-bug-dgvfnnvfs","comment":[{"@type":"Comment","text":"I’m going to repeat comments above, but that’s interesting! Lifelong learning is in business","datePublished":"2022-09-21T11:43:29.094Z","url":"https://daily.dev/posts/dGVfnNVfS#c-pejDhhRKd","author":{"@type":"Person","name":"Kirill Kurko","url":"https://daily.dev/kkurko","image":"https://avatars.githubusercontent.com/u/58859242?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"Interesting","datePublished":"2022-09-20T15:28:29.860Z","url":"https://daily.dev/posts/dGVfnNVfS#c-3U60aIS7-","author":{"@type":"Person","name":"Ivarr Reyna","url":"https://daily.dev/ivarrreyna","image":"https://lh3.googleusercontent.com/a-/ACNPEu8EazCrVhVR1VrD6baAKERb5B5qJhY32JE999r1=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Interesting read","datePublished":"2022-09-20T14:39:52.332Z","url":"https://daily.dev/posts/dGVfnNVfS#c-xGXfYAFwq","author":{"@type":"Person","name":"Shubham Kamath","url":"https://daily.dev/shubham_kamath","image":"https://lh3.googleusercontent.com/a/AItbvmmoB3Q5-dye2U3x-SpLua2TH5YE89uIhBCtt18D=s100"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}}]}
```

