Hello, Is there a way to dispatch reframe events from Javascript functions in the webpage? I would like to migrate to reframe an app I made that uses google maps. When you click on a markup in gmaps a javascript event function handler is called. I would like to know if there is a way to dispatch a reframe event from theses javascript functions. Thank you
Maybe this guide coud help you figure out https://purelyfunctional.tv/guide/state-in-re-frame/
You could write the handler in ClojureScript and export it.
1👍Wrap re-frame.core/dispatch
in a function marked with ^:export
.
Can you easily construct keywords from js? And vectors? Or will js arrays work?
That wrapper can do that. And whatever else might be needed to bridge JS and re-frame.
JS arrays will not work because there's an explicit check for vector?
.
Kaocha is a nice runner once you have many, many tests; the output is much more compact than the default runner. And more nicely colorized, I think.
@jacob429 just to add; if you're concerned about timing, dispatch-sync is another tool in re-frame you could consider 😊
When considering initialising your state in re-frame from the form-2 outer function, that is.
Reasons I would consider initializing beforehand; When the user can interact with a half-initialized app and create unfortunate states (this can be hard to spot) When showing a fully loaded page is more important than shortening pageloading times (or when load is fast enough) When there's a technical reason that something can't be shown with only partial state
Thank you for your answer
A non related question. Has anyone worked with reframe and https://react-bootstrap.github.io/? I found some examples of integrating https://github.com/burhanloey/reagent-react-bootstrap/tree/master/src/reagent_react_bootstrap. But I was wondering, given that reframe comes with its own react (from my understanding), if it was possible to tell reframe to use react-bootsrap instead of react or if that would lead to some unwanted conflicts? Thank you
re-frame doesn't come with its own React. re-frame uses Reagent, which requires React.
And react-bootstrap
is just a library built on top of React. If you decide to use it, it will just use React that's already used in your project.
Ah ok. Thanks for clarifying @p-himik
@rnait1977 it is a really good link. I've read it before bugged you peeps and it is part of the reason why I got inspired to look at local state, but thanks 👍
@reefersleep I didn't think of the dispatch-sync
and form-2 combination. I'll keep that in mind, thanks
I have a dynamic data specification which I assume will changes very rarely, but when it does it will affect the entire application. My gut feeling tells me I should avoid re-calculating how a form that I'm not currently "looking at" (in the browser) should look when (if ever) the form is shown. I might have quite a few of these forms that would all need "re-calculation". But I guess that is a problem for when (if) that actually becomes a problem.