nosco / hx

A simple, easy to use library for React development in ClojureScript.
MIT License
247 stars 16 forks source link

Props with numbers in are dropped or truncated #32

Closed danielneal closed 5 years ago

danielneal commented 5 years ago

Props that contain numbers that get passed to components defined with defnc end up going missing or having the numbers truncated.

For example - the test component below never receives a value for :x1, and receives a value for :test rather than :test2

(defnc Test
  [opts]
  (println opts)
  [:div])

[Test {:x1 0 :test2 1}]  => {: 0 :test 1 :class nil}

You can also see this if you call (hx.react/props->clj #js {"x0" 1}) directly.

I think this is because of the implementation of camel->kebab.

lilactown commented 5 years ago

Nice find! Fixed with https://github.com/Lokeh/hx/commit/3afd7d4c1fb0815006954554dc4ebdd6d80b14b0