Fork me on GitHub
#reagent
<
2019-12-10
>
nmkip15:12:05

Someone knows how to use garden to do something like:

.container input::placeholder {
  color: grey;
}

nmkip22:12:14

Thanks. phimik

Pavel Klavík22:12:36

Hi, is there a function in Reagent to convert hiccup into string? I need to pass HTML as string into a js library.

lilactown22:12:45

reagent.core/render-to-string

Pavel Klavík22:12:11

and also I don't have it, using version 0.9.0-rc3

lilactown22:12:55

oops, sorry it’s *reagent*.dom.server/*render-to-string*

Pavel Klavík22:12:45

how does that work? I am getting an error when I am trying to use it. Do I need to require something for that?

lilactown22:12:59

what’s the error?

Pavel Klavík22:12:12

`reagent.dom.server/render-to-string ------ WARNING - :undeclared-var ----------------------------------------------- Resource: :1:1 Use of undeclared Var reagent.dom.server/render-to-string -------------------------------------------------------------------------------- TypeError: Cannot read property 'render_to_string' of undefined at eval (eval at shadow$cljs$devtools$client$browser$global_eval (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:806:16), <anonymous>:1:20) at eval (<anonymous>) at Object.shadow$cljs$devtools$client$browser$global_eval [as global_eval] (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:806:16) at http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:815:44 at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:162:108) at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:814:46) at shadow$cljs$devtools$client$browser$handle_message (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.browser.js:891:37) at http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:302:151 at Object.shadow$cljs$devtools$client$env$process_next_BANG_ [as process_next_BANG_] (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:284:90) at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (http://localhost:3000/js/compiled/cljs-runtime/shadow.cljs.devtools.client.env.js:305:40)

Pavel Klavík22:12:14

ok, probably I was missing require

Pavel Klavík22:12:19

it works correctly now, thanks

👍 4
skykanin23:12:28

What's the best way to use css pseudo selectors like :hover with reagent? Is there a way to have this in the :style map for components?

lilactown23:12:25

no, it’s not. :style gets put into inline styles in the HTML element; you can’t use selectors in them like in CSS

lilactown23:12:25

the best way is to define a CSS class and give that to reagent:

[:div {:class "my-class"}]
where “my-class” is:
.my-class:hover {
  /* Hover styles here */
  color: blue;
}