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

Contruct + Call Signature for Child React Components in TypeScript JSX #843

Closed

Description

@jmfury

Can someone give a real world gist or example for how to legitimately link up a child component using a similar stack to what is provided in the ReactReduxSpa JavaScript Services Sample?

I am currently hitting errors of not having a construct or call signature no matter how I go about it.

Addressing those errors in some hacky ways, I am then hitting errors when exporting and nowhere does it [in the documentation] display a simple example of the proper usage of 'export default' or otherwise to truly export the child component for use with a parent.

In reference to the documentation here: https://www.typescriptlang.org/docs/handbook/jsx.html

I keep going in circles and since this is such a specific use case I figured I'd add an issue here.

mycomponent
exportmycomponent

Activity

  1. jmfury commented on Apr 5, 2017

    @jmfury
    Author

    Embarrassingly simple syntax issues. I should have been paying more attention to higher level component structures supplied in the project. Word to the wise though if coming from regular ES6 JS like I am, and definitely a novice with TypeScript...

    Child components (classes) should be given the 'export' keyword straight away on the class instantiation. I guess thru all the spots I was reading I never caught on to this being the approach.

    The following runs fine as a child to the map function.. (with different & appropriate props provided down obviously)

    Map function:
    syntax2

    Child component
    syntax

    Hopefully this helps someone else in the future. Not all of us are crushing it yet with this stack, to me this can fight against the next JS TS dotnetcore React/Redux novice's syntax error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions