I'm new to react/redux and trying to use this preloader lib with react/redux: https://github.com/UYEONG/react-preloader-icon
I get this error in browser console when trying to use it:
Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render
method, or you have multiple copies of React loaded...
I use it in a container component Books' render method...
- Why am I getting this error?
- What does it mean?
What is the correct way of using the preloader component?
class Books extends React.Component { constructor(props, context) { super(props, context); this.redirectToAddBookPage = this.redirectToAddBookPage.bind(this); } createBookRow(book, index) { return <div key={index}>{ book.title }</div>; } redirectToAddBookPage() { browserHistory.push('/book'); } render() { const {books} = this.props; return ( <div> <h1>Books</h1> <input type="submit" value="Add new book" className="btn btn-primary" onClick={this.redirectToAddBookPage}/> <PreloaderIcon type={ICON_TYPE.OVAL} size={32} strokeWidth={3} strokeColor="#F0AD4E" duration={800} /> <BookList books={books}/> </div> ); } } Books.propTypes = { books: PropTypes.array.isRequired, }; function mapStateToProps(state, ownProps) { return { books: state.books }; } export default connect(mapStateToProps)(Books);