javascript - Uncaught TypeError: DB.find is not a function in React with Meteor 1.3 -


i'm using meteor 1.3 react , got error. if use console in browser works perfectly.

import react, {component} 'react';  import trackerreact 'meteor/ultimatejs:tracker-react';    import toolsform './toolsform.jsx';  import toolscards './toolscards.jsx';      export default class tools extends trackerreact(component) {    		constructor(){  	        super();    	        this.state = {  	            subscriptions: {  	                tools: meteor.subscribe('alltools')  	            }  	        }  	    }    	    componentwillunmount() {  	        this.state.subscriptions.tools.stop();    	    }    	    tools() {  	        return tools.find().fetch();  	    }     		render() {    			return (  				<div>  					<toolsform /> <br/><br/>  					<ul classname="resolutions">  	                    {this.tools().map( (tool)=> {  	                        return <toolscards key={tool._id} tool={tool} />  	                    })}  	                </ul>  				</div>			  			)	  		}  		  }

and got error message:

   uncaught typeerror: tools.find not function tools @ tools.jsx:25render @ tools.jsx:35(anonymous function) 

tools react component in code. find should used on collections, not on react components. you'll need define meteor.collection.

see example code here: https://github.com/ultimatejs/tracker-react


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -