Fork me on GitHub
Baishakhi Saha15:07:35

Does anybody know how to write the following syntax in clojurescript window.location.href=""? So far I've tried (set! (. js/window location -href) "")

Baishakhi Saha15:07:43

The error that I am getting is *set! target must be a field or a symbol naming a var*


(. js/window location -href) returns the data at that location

Baishakhi Saha16:07:47

@noisesmith thanks a lot for the reply. What I'm trying to do is set the onclick attribute to location.href='' within the input tag to make a button which goes to another url, only by using reagent. I have implemented the html form before this, but strangely enough I'm redirected to a different url ( in this case an authorization end point not exactly valid or matching to where it needs to go). I was simply trying to check what happens if I use an input of type button acting as the link instead, but the real issue is with the form with the misdirected action.. any help would be appreciated!


@baishakhi almost correct, should be: (set! (.. js/window -location -href) ...)

Baishakhi Saha16:07:34

@thheller that worked. Thanks!


how do i mimic the behavior of <!! in cljs async?


you can’t turn an async process into a blocking one in JS, so you’ll need to put your code that takes from the channel inside a go form


i’m using re-frame so this is going to be tricky. i need to read from local storage before executing the event using a coeffect. i’ll maybe check over in re-frame 😕


what does local storage have to do with core async, tho?


i’m using react native and therefore using asyncstorage as an interface


yeah coeffects are fundamentally synchronous, so I don’t think you’ll be able to use cofx for this


I think you’ll have to get the value from the asyncstorage and then dispatch the event


not a bad idea