I'm trying to create dynamics refs for custom components created through the map function.
class PostsList extends Component {
constructor(props) {
super(props);
}
componentDidUpdate = () => {
console.log(this.refs);
}
render() {
let posts = this.props.posts || [];
return (
<div ref="test">
{posts.map((post) => {
return <Post post={post} key={post.id} ref={post.id}></Post>
})}
</div>
);
}
}
export default PostsList
the console.log
returns the correct DOM node for refs.test
but for the ones in the loop, it's returning a Connect
Object.
Can someone point me in the right direction?