{"action":"opened","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/316","repository_url":"https://api.github.com/repos/airbnb/enzyme","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/316/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/316/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/316/events","html_url":"https://github.com/airbnb/enzyme/issues/316","id":147519874,"number":316,"title":"Refs not working in component being shallow rendered","user":{"login":"leopoldjoy","id":8941653,"avatar_url":"https://avatars.githubusercontent.com/u/8941653?v=3","gravatar_id":"","url":"https://api.github.com/users/leopoldjoy","html_url":"https://github.com/leopoldjoy","followers_url":"https://api.github.com/users/leopoldjoy/followers","following_url":"https://api.github.com/users/leopoldjoy/following{/other_user}","gists_url":"https://api.github.com/users/leopoldjoy/gists{/gist_id}","starred_url":"https://api.github.com/users/leopoldjoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leopoldjoy/subscriptions","organizations_url":"https://api.github.com/users/leopoldjoy/orgs","repos_url":"https://api.github.com/users/leopoldjoy/repos","events_url":"https://api.github.com/users/leopoldjoy/events{/privacy}","received_events_url":"https://api.github.com/users/leopoldjoy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-11T18:55:21Z","updated_at":"2016-04-11T18:55:21Z","closed_at":null,"body":"Hello,\r\n\r\nI am trying to shallow render a component and test it using `enzyme`. My component looks like this:\r\n\r\n    class LogIn extends Component {\r\n      static propTypes = {\r\n        login: PropTypes.func\r\n      };\r\n\r\n      handleSubmit = () => {\r\n        const email = this.refs.email;\r\n        this.props.login(email.value);\r\n      };\r\n      render() {\r\n        return (\r\n          <div>\r\n            <input type=\"text\" ref=\"email\" />\r\n            <button onClick={this.handleSubmit}>Click me!</button>\r\n          </div>\r\n        );\r\n      }\r\n    }\r\n\r\nInside one of my tests with `karma` and `enzyme`, I run the following line:\r\n\r\n    buttons.at(0).simulate('click'); // This is the button element\r\n\r\nThis results in this error:\r\n\r\n    TypeError: Cannot read property 'value' of undefined\r\n\r\nBasically the `this.refs` are undefined. I can't seem to get the refs to work inside the component that I'm testing. Is this even possible with `enzyme`?"}}