react-experiments
react-experiments copied to clipboard
extra <span> after <Parametrize>
so the case is everytime i put injectedExperiment the component are wrapped with extra , i check it with react-dev-tools The issue as in example
<Parametrize props= props=>
<span> #extraSPAN issue
<imageComponent />
</span>
</Parametrize>
and this issue make the component styling a mess which is really annoying. my workaround for this are passing it from another component, so the experimentParams are passed from parent component.
I don't really know what can be done about this - we need to wrap the component with something. What do you suggest as an alternative? Could you put it up as a PR?
https://github.com/HubSpot/react-experiments/blob/master/src/parametrize.js#L72-L76 Does that span
need to be there? Could it just be:
return renderedChildren;
afaik that'll be a problem since it wouldn't be wrapped in a parent element (similar to this issue: https://github.com/facebook/react/issues/2127), but it's easy to try it out and you're probably right. I'll try to see if it's OK later today.
if you simply remove the parent element you get the following error:
Invariant Violation: Parametrize.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.
Oh right, I didn't consider that renderedChildren
is actually an array.