react-chatbot-kit
react-chatbot-kit copied to clipboard
Sharing State Between Custom Messages
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