question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Stepper] Difficult to compose without learning implementation details

See original GitHub issue

I’ve been struggling to use the Stepper component, as it seems to rely a lot on refs and React.cloneElement. This means that you can’t simply compose the component together, as you need to know where and what-for refs, passed props are needed.

Here’s a simple reproduction: https://stackblitz.com/edit/w2vekn

I’ve had to look around multiple files in the Stepper* tree to understand that you can fix the first example by passing any props along to the StepLabel.

I think it’d be simpler if the component used context instead of cloneElement.

The same visual glitches happen if you were to try to pull the Step component inside your own custom one and give that custom component as children to Stepper, if you do that, then you lose the connector.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Jun 11, 2020

Agree, I think that using the Step would make more sense here.

1reaction
oliviertassinaricommented, Jun 10, 2020

@baterson Thanks, the reason is that shallow and .find(ComponentName) will be bottlenecks in the update of the implementation. Ideally, we would like to be able to update the implementation without changing a single test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Stepper] Difficult to compose without learning implementation ...
I've been struggling to use the Stepper component, as it seems to rely a lot on refs and React.cloneElement. This means that you...
Read more >
Design Guidelines for Input Steppers - Nielsen Norman Group
Implement input steppers for those fields that have a clear, preferred value that users will adjust only slightly. Stepper segments should be ...
Read more >
Stepper Motors and Arduino - The Ultimate Guide
In this tutorial we will learn everything we need to know about controlling stepper motors with Arduino and the A4988, DRV8825 and TMC2208....
Read more >
Flutter - Stepper Widget - GeeksforGeeks
In this article, we will learn about the Stepper widget in Flutter. A stepper widget displays progress through a sequence of steps.
Read more >
How to Get Better at Music Composition (15 Do's and 5 Don'ts)
The short answer to get better at music composition is simply "practice". Just like anything else, the more you do it the better...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found