Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass child elements in as a third argument to component's body #4

Merged
merged 1 commit into from
Oct 3, 2022

Conversation

fewkz
Copy link
Owner

@fewkz fewkz commented Oct 2, 2022

Allows you to write the following code

local Button = froact.c({}, function(props, hooks, children)
    return froact.ImageButton({
        BackgroundColor3 = props.color
     }, children)
end)
local element = Button({}, {
    UIScale = froact.UIScale({ Scale = 2 })
})

rather than having to get children via props[froact.Roact.Children]
This also removes that key from props, so you must use children via the third argument from now on.

@fewkz
Copy link
Owner Author

fewkz commented Oct 2, 2022

We should probably do the same thing for templates, by passing a second arg to the onUpdate callback functions with the children

@fewkz fewkz merged commit b2182f6 into main Oct 3, 2022
@fewkz fewkz deleted the children-arg branch October 3, 2022 22:28
@fewkz
Copy link
Owner Author

fewkz commented Apr 8, 2023

turns out this broke everything somehow? I should of noticed earlier...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant