Skip to content
This repository was archived by the owner on Dec 31, 2020. It is now read-only.
This repository was archived by the owner on Dec 31, 2020. It is now read-only.

[Discuss] useObserver, utility hooks #97

Closed
@joenoon

Description

@joenoon

I'm doing some experimentation/refactoring in light of #38 and #94, and just in general catching up. I have a few places where useComputed works quite well. What I'm starting to think is the pattern of useObserver as the last return is actually the root of a few problems.

For one, it means you can never do an early return (since a hook is the last return), which is a huge annoyance to me.

Second, using the useObserver hook as the last return creates a split in the component of unobserved/observed behavior, which I think is just adding complexity.

I've started going back to wrapping components with observer directly and liking how it feels so far. Under the hood it's still using useObserver, but it's around the entire component.

Happy to be completely wrong on this or have my mind changed, but is it possible useObserver is really something that should be more of an internal implementation detail and not exposed to the user?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions