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

implement useRef hook #130

Closed
JRJurman opened this issue Oct 17, 2019 · 3 comments · Fixed by #196
Closed

implement useRef hook #130

JRJurman opened this issue Oct 17, 2019 · 3 comments · Fixed by #196

Comments

@JRJurman
Copy link
Member

Summary

React has a useRef hook which is useful for having a mutable value that persists across renders and doesn't trigger re-renders itself. We should add a similar hook for tram-one!

Potential Implementation

Similar to how the useState hook works, we should use the workingKey value to create uniquely namespaced keys. However we can create a direct mapping to the global space with this namespaced key (rather than creating a Hover Engine action group).

@JRJurman
Copy link
Member Author

This ticket may become easier to understand after the diagrams for #128 is resolved. Any questions can be directed to me in the interim, either here or on our slack.

@JRJurman
Copy link
Member Author

JRJurman commented Jan 8, 2021

So, this can be potentially resolved by providing a ref in the useEffect hook. This would be really trivial to do, and can be added as a minor (non-breaking) change.

@JRJurman JRJurman removed the difficult label Jan 8, 2021
@JRJurman
Copy link
Member Author

There are effects that depend acting on the element that is generated, and using useRef here could be a good way to "do these things anytime a rerender is triggered" - since those effects are dependent on the instance of the element that is rendered.

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 a pull request may close this issue.

1 participant