LucasBassetti / react-simple-chatbot

:speech_balloon: Easy way to create conversation chats
https://lucasbassetti.com.br/react-simple-chatbot/
MIT License
1.73k stars 598 forks source link

Use steps in custom component #275

Open keren-or-b opened 4 years ago

keren-or-b commented 4 years ago

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: , WaitAction:true }

leo-holanda commented 3 years ago

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>;
};