Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

<Rating name='facilityRate' 
emptySymbol={<img src='../star-empty.png' className='icon' alt='empty star' />}
fullSymbol={<img src='../star-full.png' className='icon' alt='filled star' />} 
onChange={this.handleRatingChange} 
value={this.state.form.facilityRate} />


handleRatingChange(value) {
    console.log(value);
    //here set your state for rating
}
Comment

× error: element 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

In my case (using Webpack) it was the difference between:

import {MyComponent} from '../components/xyz.js';
vs

import MyComponent from '../components/xyz.js';
The second one works while the first is causing the error. Or the opposite.
Comment

PREVIOUS NEXT
Code Example
Javascript :: .pop javascript 
Javascript :: compare text 
Javascript :: react native version 
Javascript :: iterating map javascript 
Javascript :: arrow functions basic usages in javascript 
Javascript :: disable input field javascript 
Javascript :: how to call function from another component in vue js 
Javascript :: javascript add to a dictionary 
Javascript :: array sort 
Javascript :: Javascript Scrape content from a website source code 
Javascript :: how to use array of object in react 
Javascript :: destructuring in javascript 
Javascript :: object set js 
Javascript :: react sass 
Javascript :: javascript sort array of objects by key value ascending and descending order 
Javascript :: javascript document get by attribute 
Javascript :: js random seed 
Javascript :: object.assign in node.js 
Javascript :: get the max value from array js 
Javascript :: js arrow function vs function 
Javascript :: javascript array length 
Javascript :: append to array in js 
Javascript :: simple website with html css and javascript 
Javascript :: random password generator javascript 
Javascript :: js find intersection point 
Javascript :: in express how do you set the location header 
Javascript :: javascript get image data from clipboard 
Javascript :: how to select text from event.target.value 
Javascript :: p5js right mouse button released 
Javascript :: change h2 to h1 using javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =