Error running example in readme
isaacs opened this issue · 1 comments
isaacs commented
Hi, when I try to run the example in the readme, I get this error:
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `SearchQuery`.
in SearchQuery
in App
The above error occurred in the <div> component:
in div (created by Box)
in Box (created by SearchQuery)
in SearchQuery
in App
React will try to recreate this component tree from scratch using the error boundary you provided, App.
Warning: App: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.
(node:64515) UnhandledPromiseRejectionWarning: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `SearchQuery`.
at invariant (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:53:15)
at createFiberFromTypeAndProps (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:1913:11)
at createFiberFromElement (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:1934:15)
at createChild (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:4008:28)
at reconcileChildrenArray (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:4259:25)
at reconcileChildFibers (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:4582:14)
at reconcileChildren (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:6385:28)
at updateHostComponent (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:6846:3)
at beginWork (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:7632:14)
at performUnitOfWork (/Users/isaacs/dev/js/tap/node_modules/react-reconciler/cjs/react-reconciler.development.js:11295:12)
(node:64515) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:64515) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Using ink@2.1.1, react@16.8.6. Same on node 8, 10, and 12.
isaacs commented
Ah, figured out the problem. I was doing const TextInput = require('ink-text-input')
and needed to be doing const TextInput = require('ink-text-input').default
, because transpiled ESM.