Git Product home page Git Product logo

Comments (6)

ferdaber avatar ferdaber commented on March 28, 2024

Does this work using the standard InstanceType<typeof ComposedComponent>? Instead of declaring ComposedComponentInstance = Component<ComposedComponentProps>?

from react.

OliverJAsh avatar OliverJAsh commented on March 28, 2024

Yes, thanks! Just updated: https://gist.github.com/OliverJAsh/d2f462b03b3e6c24f5588ca7915d010e#file-foo-tsx-L7

from react.

swyxio avatar swyxio commented on March 28, 2024

really appreciate the input, @OliverJAsh

the HOC section is a bit messy right now and i think it could be better.

by presenting so much functionality upfront we risk accidentally giving the impression that HOCs are always this complicated in typescript.

i think the better approach is to progressively build up from a "basic" HOC, then show how to deal with prop conflicts with Omit/Optionalize, then add displayName, then add ref forwarding and other stuff.

We should also try to show usage example at each step so it helps users quickly scan for the kind of HOC they need to make, and then expand to see the recommended typing strategy.

a lot of work, i know. dont have time now but i'll get to it if someone doesnt beat me to it

from react.

ferdaber avatar ferdaber commented on March 28, 2024

We may need a section just on how to write HOCs, to not completely blow up the advanced section?

from react.

swyxio avatar swyxio commented on March 28, 2024

i'm open to this. either way we gotta write some stuff haha

from react.

stale avatar stale commented on March 28, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.