Fetch api in react js with whatwg-fetch in IE - reactjs

I have written application in react js which is fully functional in Chrome browser and willing to adapt the same into IE and other browsers.
I have used whatwg-fetch polyfill for fetch api in IE and below is screenshot it always go to error block of code and says access denied for Anonymous function called.
Any clues regarding above issue will be highly appreciated.

Related

Testing Google Autocomplete in Jest react

I have a tricky situation over here. I have used an npm module:- use-places-autocomplete to get autocomplete suggestions from google maps autocomplete API. Below is the link for the npm module and the CDN link I am using in my react app in public index.html.
Link:- https://www.npmjs.com/package/use-places-autocomplete
CDN:- "https://maps.googleapis.com/maps/api/js?key={MY_API_KEY}&libraries=places&region=us"
The issue is coming when I am testing this link in tests. I am using Jest and React testing library. I am not getting any response (mock response which i have hardcoded in the codebase) when i start typing in the address.
I have tried the following things:-
Mocking the use-places-autocomplete response. But it did not work.
Using MSW for intercepting the CDN. It also didnt work.
In the test suite, adding the script of Google API in beforEach and then rendering the component. It also didnt work.
Can anybody please help me in this. Thanks in advance.

Angular2 (Typescript) with STS

How to make Angular2 code written in typescript run in spring-tool-suite?
I can run the Angular 2 code written in javascript in spring-tool-suite, but in case of typescript, I am facing a lot of problems in the form of:
1. NOT FOUND errors
I am attaching a screen shot for the error
The errors you are getting (404 on javascript files) points that the backend (web server) is not configured correctly.
Potential Fix
Give webpack a go so that you only need to load a single bundle.js instead of having to over configure a web server backend.

getting 'using the in-browser JSX transformer. Be sure to precompile your JSX for production' when using reactjs

getting "You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx" Error in browser console but application working fine using reactjs. how to remove this error?
Well the issue is that rather than pre-compiling your JSX, you are having react parse it in the browser (hence the error message). The reason this is bad is that it is quite slow. To get rid of the error message I would look into the tooling it suggests in the link (I would recommend Babel) to compile your JSX in advance so the browser doesn't have to do it every single time. This will increase the performance of your page.

Unable to execute JS call: __fbBatchedBridge is undefined

I get this error only, when I use bundled js.Before bundled app works properly ,used react native version is 0.19.How to remove this error while bundled please help me
The screen shot is attached below
Ensure that your AppDelegate.m file is not registering the React URL as pointing to disk. In 0.19, no on-disk bundle is created when deploying to the simulator. It must fetch the bundle over localhost or another IP.

How do I use Google's gapi with Reactjs?

Google's gapi js library wants an onload function specified like this:
<script src="https://apis.google.com/js/client.js?onload=init"></script>
How do I interoperate this with ReactJS?
I tried using react-script-loader (https://github.com/yariv/ReactScriptLoader) which ran into some troubles because gapi doesn't yet exist when the script loader thinks it has completed returning it.
Don't know if you're still looking for this answer but I faced the same problem and the best option that I found was creating this package with all gapi script code, so now I just have to import it into my react app and I doesn't even have to wait the gapi script loaded from google apis link.
gapi-script package
I also created an example showing how you can use this package:
gapi-script example

Resources