FredrikOseberg / react-chatbot-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sharing State Between Custom Messages

jebberwocky opened this issue · comments

Can we share the state between custom messages?

scenario:

  • there are 2 custom messages A and B and
    customMessages: { a: (props) => <A {...props} />, b: (props) => <B {...props} />,

  • there is a state const [isLoaded, setIsLoaded] = useState(false); in A

  • like to share const [isLoaded, setIsLoaded] = useState(false); from A to B

  • B can call setIsLoaded

thanks