-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render step conditionally #35
Comments
You could render the steps in a function and add the condition in ex: const renderStep = ()=>{ in the render : |
This does not work because react-albus only parses the steps in the If I add or remove a step, react-albus don't handle the update. |
Right .. But fixing conditional rendering on first render would be a small fix in the |
I am looking for similar functionality. I am pulling a list of "questions" from an API. Each question is displayed on a step. Certain questions should be skipped unless the value of other questions meets a certain condition (usually checkbox=true). So my steps need to dynamically change as the user answers questions in previous steps. |
I am also looking for a similar functionality where the steps should be rendered based on conditions in the previous steps. |
With the current implementation, you would have to add all the possible <Step
id=“firstStep”
render={({ push }) => {
if (/* some conditional */) {
push('conditionalStep');
}
return (
<Fragment>
…
</Fragment>
);
}}
/> EDIT: I would like the ability to add and remove |
This issue is stale because it has been open 30 days with no activity. Remove no-issue-activity label or comment or this will be closed in 5 days. |
@andreoav were you able to find a working way of dynamic step rendering? |
This issue is stale because it has been open 30 days with no activity. |
We created our own solution to handle dynamic wizards. Unfortunately it is not open sourced. |
This issue is stale because it has been open 30 days with no activity. |
For anyone else that is faced with this issue, I worked around it with a combination of two things:
<Step
id="disabled-page"
render={({ replace }) => {
if (!isFeatureEnabled('some-feature')) {
replace('always-on-page');
}
return <PageForThisStep />
}}
/>
<Step
id="always-on-page"
component={PageForThisOtherStep}
/>
With those two approaches, I was able to achieve the same functionality that the original question was asking about. |
I might be late, but I released WhizFlow to better tackle conditionally rendering steps. |
This issue is stale because it has been open 30 days with no activity. |
Hi,
I want to know if is possible to render a step conditionally.
The following does not work.
The text was updated successfully, but these errors were encountered: