Callback not Accessible
See original GitHub issueconst PaystackHookExample = () => {
const initializePayment = usePaystackPayment(config);
return (
<div>
<button onClick={() => {
initializePayment()
}}>Paystack Hooks Implementation</button>
</div>
);
};
Callback isn’t accessible using this method
Here is a quick repro https://codesandbox.io/s/gallant-cdn-9ddke
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
javascript - How to access the correct `this` inside a callback
However, I'm not able to access the data property of the created object inside the callback. It looks like this does not refer...
Read more >How to access the correct this inside a callback
We explore the methods for accessing the correct this in a callback by explicitly forcing a context binding to point to our object...
Read more >JavaScript Callbacks Variable Scope Problem - Pluralsight
In this free JavaScript guide, you'll learn how to fix the common JavaScript callbacks variable scope problem. This step-by-step JavaScript ...
Read more >Callback not working properly if I dont have debugger in my ...
Sounds like your callback function not really works. Callbacks/promises/async-await is used for asynchronous stuff when Innovator shall wait for another client ...
Read more >Callback after Sign-up Not working - Auth0 Community
This works fine, but after signing up, Auth0 calls my /register route in an infinite loop. It doesn't call localhost:3000/callback (which I ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@iamnotstatic you need to pass in those callbacks to intializePayment
const PaystackButton = ({ text, className, children, onSuccess, onClose, ...others }: PaystackButtonProps): JSX.Element => { const initializePayment = usePaystackPayment(others); return ( <button className={className} onClick={(): void => initializePayment(onSuccess, onClose)}> {text || children} </button> ); };
the code sandbox link has been edited so you can understand better
Requires callback to be passed to initializePayment