I'm trying to translate a antd
react form item to reagent-hiccup.
The original react component is something like this,
<Form.Item>
{
<Input
prefix={<Icon type="user"/>}
placeholder="Username"
/>
}
</Form.Item>
And I tried the below variations when I tried to convert it into reagent hiccup representation.
Variation 1:
[:> Form.Item
[:> Input
{:prefix [:> Icon {:type "user"}] :placeholder "Username"}]]
Variation 2:
[:> Form.Item
[:> Input
{:prefix [:> js/antd.Icon {:type "user"}] :placeholder "Username"}]]
Variation 3:
(defn antd-username []
[:> Form.Item
[:> Input
{:prefix (r/as-component [:span [:> Icon {:type "user"}]]) :placeholder "Username"}]])
None of them worked and I'm getting the below error,
Uncaught Error: Objects are not valid as a React child (found: object with keys {type}). If you meant to render a collection of children, use an array instead.
in span
in span
in Unknown (created by ForwardRef)
in ForwardRef (created by ForwardRef)
in ForwardRef (created by app.auth.views.login.antd_username)
in div
in div
in div (created by Col)
in Col
in Unknown
in div (created by Row)
in Row
.
.
.
.
Whereas if I remove the prefix part it works. So I don't have any other issues.
What's the right way of converting the aforementioned component to reagent-hiccup?