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

Ref doesn't properly render with Enzyme. #3694

andrewplummer opened this issue Jul 10, 2019 · 3 comments


None yet
2 participants
Copy link

commented Jul 10, 2019

Bug Report

It seems that the Ref HOC doesn't play well with Enzyme. Using shallow will result in a warning and render or mount will throw an error.


import React from 'react';
import { configure, shallow, render, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { Ref, Container } from 'semantic-ui-react';

configure({ adapter: new Adapter() });

function Foo() {
  const ref = React.createRef();
  return (
    <Ref innerRef={ref}>

describe('foo', () => {
  it('blahblah', () => {
    const wrapper = shallow(<Foo />);

Expected Result

Element should properly be wrapped/rendered/mounted.

Actual Result

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.



@triage-new-issues triage-new-issues bot added the triage label Jul 10, 2019


This comment has been minimized.

Copy link

commented Jul 10, 2019

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.


This comment has been minimized.

Copy link

commented Jul 10, 2019

What version of Enzyme you're using? Can you please provide a repro?



We testing all our components with Enzyme and will be really strange to have such issue.


This comment has been minimized.

Copy link

commented Jul 10, 2019

Apologies! I had confirmed several times and this was not working and now it's working great! I may have unintentionally upgraded some libs or something in the meantime. At any rate I've switched to using the Ref HOC and everything works as intended! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.