Skip to content

js struct tag - how does it work? #114

Closed
@maddyblue

Description

@maddyblue

I'm working on reactjs bindings, but can't figure out how the struct tags work. I have:

type Class struct {
    DisplayName string           `js:"displayName"`
    Render      func() Component `js:"render"`
}
c := Class{
    DisplayName: "Player",
    Render: func() react.Component {
        return react.DIV
    },
}

Printing c in the js console, I get:

Object {$val: Object, DisplayName: "Player", Render: function, $key: function, $get: function}

I expected it to have members displayName and render due to the struct tags. Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions