react icon indicating copy to clipboard operation
react copied to clipboard

nesting of components fails with latest stable React + TypeScript + AMD/require.js

Open KoenT-X opened this issue 10 years ago • 2 comments

I currently have a working example of a project that uses the latest React + TypeScript (using .tsx files), together with the AMD module loading system (with require.js) and building/running/debugging in Visual Studio 2015 CE.

However, if I now try to nest 2 React components into a "parent" React component, I am getting exceptions in require.js when running the app...

The "child" React components are working fine individually, so the problem really seems to come from the nesting itself.

If I run the same project using an older version of React (13.x) and not using AMD modules, then the app works fine, also when nesting the React components.

I've made a test repository public here: https://bitbucket.org/KoenT_IM/typescriptreactvs2015tests

  • HelloPenguin is the old project (using React 13.x and not using AMD)
  • HelloPenguin_React0.14.6_AMD is the new project (latest React 0.14.6 and using AMD) If you remove lines 41 and 42 in ApplicationView.tsx, you will see that the app runs fine, and the individual React components also work fine.

This must be something I'm overlooking, but I can't seem to pin it down... Does anyone know what could be wrong here and how to fix this problem? Thanks!

KoenT-X avatar Feb 01 '16 16:02 KoenT-X

This looks like it is probably a usage question related to your environment/configuration, rather than a bug in the React core. Usage questions are better answered on sites like StackOverflow, as we try to use github issues for tracking bugs in the React core. For this reason, I'm going to close out this issue, but feel free to continue the conversation on this thread or move it to StackOverflow.

If you can reduce the problem to a demonstrable bug in the React core, we can re-investigate.

jimfb avatar Feb 01 '16 19:02 jimfb

OK, Jim, you're right. More a usage/configuration issue, not really a React bug. Someone also found the issue in the meantime, and it's now fixed (path prefix for subcomponents needed a "./" prefix...). Sorry for the noise.

KoenT-X avatar Feb 02 '16 10:02 KoenT-X