react-stamp icon indicating copy to clipboard operation
react-stamp copied to clipboard

[WIP. Do not merge.] Attach render function to the stamp prototype

Open koresar opened this issue 8 years ago • 3 comments

Some modules check if FooComponent.prototype.render exists. More info can be provided by @FredyC

This is just a sample change. @troutowicz please review.

koresar avatar Jun 24 '16 12:06 koresar

@koresar Yea actually it seems I had been using that react-redux-provide in a bit wrong way, so it seems I wont need that change after all :) However it's not a bad change in my opinion, since render method is one of key points to identify React component, might be useful to have it there.

danielkcz avatar Jun 24 '16 12:06 danielkcz

I guess I'd like to see an example of why this change would be useful. We can already test if the stamp is a valid React component using React's test utilities.

import assert from 'assert';
import React from 'react';
import reactStamp from 'react-stamp';
import { isCompositeComponent } from 'react-addons-test-utils';

const stamp = reactStamp(React).compose({
  render() {}
});

assert.ok(isCompositeComponent(stamp()));

troutowicz avatar Jun 24 '16 20:06 troutowicz

@troutowicz You are describing a case when you actually have component instance. However there are other modules (eg. react-redux-provide) that wants to check if given class is component by inspecting its prototype.

danielkcz avatar Jun 24 '16 21:06 danielkcz