Polyfill for [self].map?
See original GitHub issueHi, 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:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Top 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 >
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 Free
Top 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

Dev branch is here: https://github.com/avkonst/hookstate/tree/version-3
Just upgraded to v3. Thanks a lot