Confusion around hasSlideChildren doc
See original GitHub issueI’ve been fighting with this for a bit, and even debugging through the code, I’m a little confused as to how hasSlideChildren is supposed to work.
It looks from the code, as well as the doc, that if an element has hasSlideChildren set, it will look at that element’s children. That works well enough if I do something like (though it kinds of defeat the purpose):
<Deck
transition={['zoom', 'slide']}
transitionDuration={500}
theme={theme}
>
<MySlides hasSlideChildren>
<Slide>1</Slide>
<Slide>2</Slide>
</MySlides>
</Deck>
But if I make a MySlides
components that return the 2 slides, and put hasSlideChildren as per the doc:
class MySlides extends Component {
render() {
return (
<div hasSlideChildren>
<Slide>1</Slide>
<Slide>2</Slide>
</div>
)
}
}
And then, in my Presentation component, I import MySlides and use it as a child of Deck, there’s two issues:
First, if using a div, React will complain that I’m using a non-supported property. Easily fixed by using the SlideSet component that I found looking through the code.
Second and more importantly: the hasSlideChildren prop is now on a child of MySlides, and Spectacles will never see it.
So I’m a bit confused: did I just completely misunderstand how it’s meant to be used?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
ok, if I have a module that exports (notice this is not a component, just a bunch of JSX):
and then I consume this, eg:
That works. But somehow I expect that’s not the intended usage. (Its good enough to unblock me for now though)
Hey everyone, this issue is related to a known bug that we’re in the process of fixing! Just wanted to give an update.