Skip to content
Advertisement

Changing the prop value of embedded component

I have made a tab-component and a progressbar with 3 tabs. When i select the first tab i want my progressbar to be at 33%, second tab 66% and third 100%.

I need some help figuring out how to make my progress-bar change it’s value when i change tabs. The progress-meter fills up when you give a value of 0-100 in the component props.

So.. should i use redux to track the value or what do you guys suggest. Thanks a billion

Image of progress-bar

Progress-bar code

Advertisement

Answer

You can just set the progress value in the state on click of the tab items like below

JavaScript

You can also render <li> dynamically to create a proper component

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement