Fork me on GitHub

@b2berry take a look at step 3 The way we’ve used stripe is creating an element in stripe, calling a function on that element to mount it to a div. And then calling the addEventListener function on that element and giving it a callback. All of this life cycle is managed using a form 3 component


Thanks caleb. I actually just an hour ago got the stripe react components working which might do the trick.


Reflecting on this defining the card element might be best done in the lifecycle of the component


I might double back and consider your approach using the Stripe Checkout.js solution, which ultimately I wanted to use moreso than Stripe.js and custom route.


Okay good luck! 🙂


Have you had any issues with the event listener not getting removed appropriately?


I don’t think so, assuming the lifecycle method :component-will-unmount (or another similar) is set up correctly.


Are you running into issues with that are just wondering?


No, I’d need to take this approach for a test drive. I just get a little uneasy around coordinating listeners. Probably just residual PTSD from many years back in the early jQuery days.


mounting and unmounting happens when a component is removed from the view. So as long as you completely remove it from the view the unmount lifecycle should call whatever you give. I’m quite confident in that. In the past we’ve had modals that have had to stay in the view for animations that have caused complications around this though so take that into consideration. As far as the reliability of the create & remove event listeners on the stripe component goes I’m not to sure. I’d assumed it worked correctly. You could test this by removing the event listener manually while the component is in the view and ensure that your events stop firing


Groovy thanks!


When working locally is there a way to have http data I fetch hang around on hot-reload?


@dfcarpenter Where are you putting this data? If it is in app-db it will hang about


Is there a way to check if kwd has already been previously registered using (reg-event-fx kwd ...)?


Have a list of route handler keywords, and want to register a default handler for any route that hasn't yet been registered (if that makes sense).


@samedhi there is no officially sanctioned way. As @codonnell indicates, you'd have to reach into the implementation. if you wanted to access the handler for id then: (get-in re-frame.registrar.kind->id->handler [:event id] :not-there))