Skip to content
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
jmfury opened this issue Apr 4, 2017 · 1 comment
Closed

Comments

@jmfury
Copy link

jmfury commented Apr 4, 2017

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

@jmfury jmfury closed this as completed Apr 5, 2017
@jmfury
Copy link
Author

jmfury commented Apr 5, 2017

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant