Thinking in ReactJS

Thinking in ReactJS

ยท

1 min read

Hello! ๐Ÿ‘‹ In this blogpost, Let's think how to create a simple SideBar component in ReactJS.

First of all, let's see the picture of what to build.

2021-10-15 19-51-42 (online-video-cutter.com).gif

In order to build this component in React, we need to think how to build it. let's take a quick look on the approach.

Block Diagram

Side bar block diagram.jpg

Block diagram contains the bigger picture of component / Declarative approach. we want to create SideBar component, such that it is reusable. It contain many tab inside it. which in turn is the Tab component, same tab component is reused inside the SideBar which avoid the repetition.

Now in order to understand, how the data flows. Let's look into Flow Diagram.

Flow Diagram

Flow diagram.jpg

SideBar component is communicating with Tab component using activeTab and onTabClick props. activeTab holds the state of active tab. onTabClick prop will detect the target and make it active, in short the clicked tab will become active using onTabClick prop.

can check out the working link of this component SideBar component

Thanks for Reading !

ย