So I have an app that consists of a stepper i.e. a set of slides, each having a question and some form elements like radio buttons, gallery tiles to show choices for the answer to the question and in the end, submit some data.
I have a component for the slide (lets say its called <Slide />
) and there are only particular types of slides, e.g. some with radio buttons, some with gallery, some with a form etc.
Each slide component receives the data (an array of options) and the type of UI element that needs to be rendered, among other props which pertain to that type of slide.
What's a good design pattern that could be used to write this component?
Should I just pass a prop uiElement
and render a different element based on that or maybe create template components like <RadioSlide />
, <FormSlide />
each containing a <Slide />
component with different values of props?
Aucun commentaire:
Enregistrer un commentaire