First, wanted to just call out for any other users who find this page, that you can find a clarification on this forum post: Accessing builderState in custom components withChildren - #2 by will
While using props.builderState.context.callbackFn()
will work, Builder also provides the BuilderStoreContext
for this.
So instead of
const builderState = useContext(BuilderStoreContext);
const handleSubmit = () => {
builderState.context.passedHandleSubmit();
};
You can use:
const handleSubmit = () => {
props.builderState.context.passedHandleSubmit();
};
Either works, but BuilderStoreContext
provides a convenient, Builder-provided way to access the context of your app