javascript - `react-slick` - type is invalid error -
i getting uncaught (in promise) error: element type invalid: expected string (for built-in components) or class/function (for composite components) got: object.
error when tried require 'react-slick` webpack.
const react = require("react"); const slider = require("react-slick"); function mediacarousel(props) { const settings = { dots: true, infinite: true, speed: 500, slidestoshow: 1, slidestoscroll: 1 }; return !props.stories ? null : <slider> <div><h3>1</h3></div> <div><h3>2</h3></div> <div><h3>3</h3></div> <div><h3>4</h3></div> <div><h3>5</h3></div> <div><h3>6</h3></div> </slider> } exports.mediacarousel = mediacarousel;
it fixed when tried
const slider = require("react-slick").default;
i suppose react-slick not correctly exporting module or loader has issue.
Comments
Post a Comment