Fork me on GitHub
#reagent
<
2017-02-18
>
souenzzo00:02:15

😮 Reagent has react-class-methods Very thanks. Awesome page,

pesterhazy00:02:19

Very welcome!

souenzzo14:02:32

I have a big (npm/react/jsx) project. Is there any migration plan to use npm/jsx mixed with reagent?

mateusz.fiolka17:02:27

Hi, is there a way to set custom attributes for tags? I know I can just use arbitrary map key to do that, but React has a whitelist to pass/ignore attributes. However .. it's possible to use the is attribute to disable the whitelist. That would be great if I could set an attribute which has no value in reagent. Anyone has an idea to overcome this? I need a custom attribute to be set on electron webview element.

pesterhazy17:02:52

hm you can use data-sadf etc. attributes, can't you?

mateusz.fiolka17:02:21

No, because I need to set disablewebsecurity attribute which has no value and is not in the whitelist

mateusz.fiolka17:02:05

If I there would be a way to set an attribute without value - I could set disablewebsecurity and is which disables the whitelist

pesterhazy17:02:42

you could use dangerouslySetInnerHTML ?

pesterhazy17:02:56

I haven't heard about is, is this documented?

mateusz.fiolka17:02:15

I'm not sure it's documented, but it works (I did it in js)

mateusz.fiolka17:02:52

dangerouslySetInnerHTML and other non-elegant ways should work, but I'm wondering if maybe there is a simpler way

pesterhazy17:02:02

what does is do?

mateusz.fiolka17:02:26

It allows to set any attribute on the tag, and it won't be whitelisted by react

pesterhazy17:02:48

by the way, why does react even check attributes?

pesterhazy17:02:52

do you know?

mateusz.fiolka17:02:14

It is documented: http://reactjs.cn/react/docs/jsx-gotchas.html > However, arbitrary attributes are supported on custom elements (those with a hyphen in the tag name or an is="..." attribute).

pesterhazy17:02:31

hm it's mentioned but not really explained

pesterhazy17:02:37

but maybe that's just JSX?

pesterhazy17:02:54

check out what React Element gets generated

mateusz.fiolka17:02:32

It worked in reagent though, I now checked {:is true :disablewebsecurity true} and disablewebsecurity landed in dom

pesterhazy17:02:42

problem solved?

pesterhazy17:02:36

although the docs mentioned is should be a string?

mateusz.fiolka17:02:05

@pesterhazy Maybe the docs are inaccurate. Looks like it works. Thanks for help 🙂

pesterhazy18:02:48

your interpretation in borne out by this anwer: http://stackoverflow.com/a/33860892

pesterhazy18:02:01

is is a weird attribute name to pick

mateusz.fiolka18:02:23

I'm just a poor api consuemer 🙂

mateusz.fiolka18:02:59

I guess the code just checks the key and ignores the value.

pesterhazy18:02:21

the attribute checking is weirdly paternalistic

pesterhazy18:02:29

but whatever 🙂