---
title: "Discussion on \"How to Build Accordion In React From Scratch Without Using Any External Library\" | Hashnode"
description: "Discussion on \"How to Build Accordion In React From Scratch Without Using Any External Library\". As you might be aware, there are many applications of accordions like displaying a list of FAQs, various menus and submenus, for displaying various locations of a particular company and so on.\nSo In this article, we'll see how to build an accordion i..."
url: "https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Build Accordion In React From Scratch Without Using Any External Library](https://blog.yogeshchavan.dev/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library?utm_source=hashnode&utm_medium=feed)

As you might be aware, there are many applications of accordions like displaying a list of FAQs, various menus and submenus, for displaying various locations of a particular company and so on. So In this article, we'll see how to build an accordion i...

Mar 17, 2021 · 7 min read · blog.yogeshchavan.dev  
Updated Apr 26, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#codenewbies](https://hashnode.com/tag/codenewbies)

## Written by

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

@myogeshchavan97 · India

  
[View profile](https://hashnode.com/@myogeshchavan97)

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. https://yogeshchavan.dev/. Book 1:1 @ hiretheauthor.com/myogeshchavan97

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. Loves sharing knowledge through technical articles. Dev.to: https://dev.to/myogeshchavan97 https://linktr.ee/myogeshchavan97

## Responses 3

Markdown supported · ⌘↵ to post

[Rikard](https://hashnode.com/@rix1)

[Mar 25, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/605d14f3965326422a3efd3c)

Nice! Just a quick reminder using native HTML elements is the easiest way to create an accessible accordion – no JS required!

```
<details>
<summary>Section 1</summary>
Hello this is my section. 
</details>
```

Example of the above code (**edit**: Hashnode doesn't seem to use the same renderer for "preview" and after posting, so I had to take a screenshot of it)

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1616713038455/T43ton9v_.png)

See this for more details: [css-tricks.com/quick-reminder-that-details-summar…](https://css-tricks.com/quick-reminder-that-details-summary-is-the-easiest-way-ever-to-make-an-accordion/)

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Mar 26, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/605d14f3965326422a3efd3c#reply-605d6f2efc7d47424f0cbd6f)

This is so cool. I was not aware of this. Thank you 🙂

[Christiaan Kras](https://hashnode.com/@ChristiaanK)

[Mar 25, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/605c9f86b5192e3d7c42d85c)

One big issue with this is that this doesn't provide an accessible accordion. You also don't need to implement this in React since HTML provides the details and summary elements which give you native accordion functionality which is accessible as well, for free!

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Mar 26, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/605c9f86b5192e3d7c42d85c#reply-605d6f0afc7d47424f0cbd6b)

[Christiaan Kras](https://hashnode.com/@ChristiaanK) Thanks for the information

[Catalin Pit](https://hashnode.com/@Catalinpit)

[Mar 18, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/6052f0ebefc86d02c5389899)

A nice, detailed article! I should replicate this with Vue. 👀

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Mar 18, 2021](https://hashnode.com/posts/how-to-build-accordion-in-react-from-scratch-without-using-any-external-library/60518c2f416f221f065b772b/comment/6052f0ebefc86d02c5389899#reply-6052f950e47b9c0e32d7d8f2)

[Catalin Pit](https://hashnode.com/@Catalinpit) haha. Thank you so much 🙂
