question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Polyfill for [self].map?

See original GitHub issue

Hi, I’m using this exciting library in a create-react-app project. It seems that some polyfills are missing as I’m seeing errors for IE11 and mobile user when using map.

Error: Cannot read property 'map' of undefined

For instance for env: Chrome Mobile WebView Version:37.0.0 Android Version:5.0.2

Importing following in index.ts

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import 'core-js/features/number/is-integer';
import '@hookstate/proxy-polyfill';

Code:

import { useState, self, State } from '@hookstate/core';
import LoaderState from '../state/LoaderState';

export default function useLoaderState() {
  const loadingState = useState(LoaderState);

  return loadingState[self].map((state: State<boolean>) => ({
    get loading() {
      return state.get();
    },
    dispatchLoading(val: boolean) {
      state.set(val);
    },
    toggleLoading() {
      state.set((val: boolean) => !val);
    },
  }));
}

with LoaderState:

import { createState } from '@hookstate/core';

const LoaderState = createState<boolean>(false);

export default LoaderState;

Any suggestions?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
avkonstcommented, Jun 24, 2020
0reactions
MainAerocommented, Jul 29, 2020

Just upgraded to v3. Thanks a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Polyfill for Array methods: map(), filter() and reduce() - Medium
So here I'll be sharing how to create polyfill for the map, filter, and reduce array methods. Let's Code ! Pollyfill for Array.map()....
Read more >
Polyfill.io
It's a service which accepts a request for a set of browser features and returns only the polyfills that are needed by the...
Read more >
Maps and Sets, goodbye polyfill ?! - ES Discuss
I've noticed by accident Maps and Sets (simple?) now uses generators so that no polyfill will ever work anymore and Sets are pointless...
Read more >
What is a Polyfill ? - GeeksforGeeks
Polyfill is a way to modify or add new functions. ... Polyfill for map( ) function ... Data Structures & Algorithms- Self Paced...
Read more >
How to load polyfills only when needed
I know three ready-to-use approaches for that: polyfill.io; the module / nomodule pattern; the useBuiltIns option in @babel/preset-env ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found