Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra <span> after <Parametrize> #23

Open
saveroo opened this issue Oct 6, 2016 · 5 comments
Open

extra <span> after <Parametrize> #23

saveroo opened this issue Oct 6, 2016 · 5 comments

Comments

@saveroo
Copy link

saveroo commented Oct 6, 2016

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.

@rawls238
Copy link
Owner

rawls238 commented Jan 6, 2017

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?

@gusvargas
Copy link
Collaborator

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;

@rawls238
Copy link
Owner

rawls238 commented Jan 6, 2017

afaik that'll be a problem since it wouldn't be wrapped in a parent element (similar to this issue: facebook/react#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.

@rawls238
Copy link
Owner

rawls238 commented Jan 6, 2017

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.

@gusvargas
Copy link
Collaborator

Oh right, I didn't consider that renderedChildren is actually an array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants