Use strings as the type for DOM elements

This makes ReactDOM a simple helper for creating ReactElements with the string tag as the type. The actual class is internal and created by instantiateReactComponent. Configurable using injection.

There's not a separate class for each tag. There's just a generic ReactDOMComponent which could take any tag name.

Invididual tags can be wrapped. When wrapping happens you can return the same tag again. If the wrapper returns the same string, then we fall back to the generic component. This avoids recursion in a single level wrapper.
This commit is contained in:
Sebastian Markbage committed 2014-10-02 23:05:11 -07:00
1 parent 35764c5ffb
commit 3aaccd2dc9
16 files changed
+328 -215

No files matched your search

+2 -2
View File
@@ -106,7 +106,7 @@ mergeInto(reactComponentExpect.prototype, {
toBeComponentOfType: function(convenienceConstructor) {
expect(
this.instance().constructor === convenienceConstructor.type
this.instance()._descriptor.type === convenienceConstructor.type
).toBe(true);
return this;
},
@@ -126,7 +126,7 @@ mergeInto(reactComponentExpect.prototype, {
toBeCompositeComponentWithType: function(convenienceConstructor) {
this.toBeCompositeComponent();
expect(
this.instance().constructor === convenienceConstructor.type
this.instance()._descriptor.type === convenienceConstructor.type
).toBe(true);
return this;
},