Got TypeError: Object(...) is not a function when trying to import { selectorFamily } from "recoil"
See original GitHub issueDeveloper Story
As a developer
I want to use the selectorFamily
helper function
So that I can make asynchronous queries with parameters
Description
I am trying to make an asynchronous data query with parameters. So I am trying to use the selectorFamily
helper. But when I try to import { selectorFamily } from "recoil"
, the application throws TypeError: Object(...) is not a function
.
How to fix it
Maybe exporting the selectorFamily
helper at the recoil
library.
Steps to reproduce the behavior
- Initialize or open a React project;
- Run
npm install recoil --save-exact
to install version0.0.7
; - Create a JS file;
- Try to
import { selectorFamily } from "recoil"
in this file; - Run
npm start
and check if error occurs.
Expected behavior
Application should not throw a TypeError.
Actual behavior
TypeError: Object(...) is not a function
Module.<anonymous>
src/recoil/selectors/reportedParkingsQuery.js:20
17 | throw error.response.error
18 | }
19 |
> 20 | export const reportedParkingsQuery = selectorFamily({
21 | key: "ReportedParkings",
22 | get: (carPlate) => async ({ get }) => {
23 | const response = await getParkingsByCarPlate(carPlate)
Module../src/recoil/selectors/reportedParkingsQuery.js
http://localhost:8000/commons.js:120193:30
__webpack_require__
/webpack/bootstrap:789
Environment
- OS: macOS Catalina 10.15.4 (19E287);
- Node version: v12.16.0;
- NPM version: 6.13.4;
- React version: 16.13.1;
- Recoil version: 0.0.7.
Related code
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top Results From Across the Web
TypeError: Object(...) is not a function ReactJS + Recoil
When exporting an atom and importing it into App.js, I get a TypeError: Object (...) is not a function, what is the problem?...
Read more >selectorFamily(options) - Recoil
Returns a function that returns a read-only RecoilValueReadOnly or writeable RecoilState selector.
Read more >Lessons learned from moving to Recoil.js - Kitemaker blog
If a selector returns an object or an array, Recoil re-renders if the returned value is not referentially equal (i.e. === ) to...
Read more >Uncaught TypeError | Is Not A Function | Solution - YouTube
Have you encountered an error like:- Uncaught TypeError - Some selector is not a function - jQuery is not a function - owlCarousel...
Read more >React Hooks Create Failure: Type Error Object () Ist Not A ...
import React, { useState, useEffect } from 'react'; function FriendStatus(props) { const benefits of using React local state, or might not want to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi there, thanks for the work on this library!
Is there an easy way to use selectorFamily in recoil currently? I have looked at #33 and #82 but it does not seem to be quite there yet…
Is this the same issue for using atomFamily?