roact icon indicating copy to clipboard operation
roact copied to clipboard

Pass props and state through render

Open Kampfkarren opened this issue 6 years ago • 3 comments

Closes #199

Checklist before submitting:

  • [x] Added entry to CHANGELOG.md
  • [x] Added/updated relevant tests
  • [x] Added/updated documentation

Kampfkarren avatar Oct 09 '19 19:10 Kampfkarren

Coverage Status

Coverage remained the same at 93.525% when pulling 1f2f16251ed35d06ca3fc6c4a3f81fd3b98f096c on Kampfkarren:pass-props-react into deaa8000220252f6edc27ec15e5704266560ebe5 on Roblox:master.

coveralls avatar Oct 09 '19 19:10 coveralls

This still looks good to me, but I did some digging into why React doesn't do this, and here's what I found: https://github.com/reactjs/rfcs/pull/4#issuecomment-412637588

It's a pretty important point to make! Is it something we're worried about for Roact? Is it something we think we'll need to worry about? I may be missing something, but I think the closing-over-this problem they're talking about applies pretty equivalently to Lua as well as JS

ZoteTheMighty avatar Oct 15 '19 16:10 ZoteTheMighty

One more thing to note as a followup: we do also have the same problem already with closing over initial props passed into init, so we should keep that in mind as well when we consider this.

ZoteTheMighty avatar Oct 15 '19 16:10 ZoteTheMighty