react-simple-chatbot icon indicating copy to clipboard operation
react-simple-chatbot copied to clipboard

Use steps in custom component

Open keren-or-b opened this issue 5 years ago • 1 comments

Hi, how can I use steps to pass previous step value to a custom component?

*example of what I tried but it said the definition of steps is missing { id: "1”, component: <thisComponent value=(steps[previousStep.id].value) />, WaitAction:true }

keren-or-b avatar Jul 15 '20 18:07 keren-or-b

Hi @keren-or-b. Let's say you have a step to get the user name and it's called getUserName. You can access the value this way:

const CustomComponent = ({ steps }) => {
  return <div>steps.getUserName.value</div>;
};

leo-holanda avatar Jul 01 '21 17:07 leo-holanda