React-router 2v vs React-router 3v - whats the difference? - react-router

So i am trying to go over from react router 2v to 3v, can anybody tell me the difference or where i can find more information about react router v3.

React Router v3 removed the deprecated code that had warnings in v2. It is otherwise pretty much exactly the same.
v2 is no longer being developed and v3 is pretty much just being updated for bug fixes going forward. New features are only really being added to v4, which is a configuration-free rewrite.

Related

React Native API usage

I want to display some data from our Solarpanels within an RN App. I have no experience with fetching the data from an json api like this, and the tutorials I found online is not working in this case for some reason.
Is there anyone who can take a look at this link, and point me in the right direction?
https://www.solaredge.com/sites/default/files/se_monitoring_api.pdf
When I open the API link with our API Key, I get something like this in the browser:
{"overview":{
"lastUpdateTime":"2022-02-14 13:57:00",
"lifeTimeData":{"energy":1.7024576E8},
"lastYearData":{"energy":8955.0},
"lastMonthData":{"energy":489.0},
"lastDayData":{"energy":0.0},
"currentPower":{"power":0.0},
"measuredBy":"INVERTER"}
}
I am using Ignite by Inifite Red as a boilerplate in this app, and there some builtin APISauce function I'm not familiar with if that makes it easier.
Check import you are using of dependency which is not installed and package.json so that you have installed correctly the dependencies.

Strange Angular PWA Service worker behaviour when deployed

This issue has taken up all my day, and I can't figure out whats going on
I can see that my service worker is registered , however "sometimes" when I click offline in developer tools the ServiceWorker for my domain just disappears!!
But this is the main problem when I reload the app I see the following behaviour.
You can see the ngsw.json is loaded twice and the main.js is loaded 3 times! main.d3ae2084xxxx && main.bbe5073dxxxx && then main.d3ae2084xxxx again!
If I inspect the response of both ngsw.json requests you can see that both show main.d3ae2084xxxx as the correct version of main.js but it still loads main.bbe5073dxxxx...
First ngsw.json request
Second ngsw.json request
Whats even more frustrating is the actual loaded version is the previous main.bbe5073dxxxx...!!!!
If anyone has any ideas how this can be happening please let me know.
Update... So found out about this excellent little endpoint
https://you-app-url/ngsw/state
This will give you lots of debug information about your service worker.
In my case this
Driver state: EXISTING_CLIENTS_ONLY (Degraded due to failed
initialization: Hash mismatch (cacheBustedFetchFromNetwork):
https://dev-xxxx.net/main.eb8468bb3ed28f02d7c2.js: expected
b5601102b721e0cf777691d327dc965d40d1c96e, got
83c18fdb4a5942c964a31c119a57e0b8e16fe46e (after cache busting)
So looks like this is going to be a CDN issue of some sort in my case, will update with an answer when I know for sure.
You've probably resolved this by now, but I had the same issue which turned out to be due to the CDN (Cloudflare in my instance) was optimising the content.
In Cloudflare the key option is 'Auto minify' that needs to be disabled.

react-router's browserHistory does not have location and other properties

The docs for history which react-router links to specify that histories have the following properties:
history.length - The number of entries in the history stack
history.location - The current location (see below)?
history.action - The current navigation action (see below)
But browserHistory from react-router does not have these properties. Is this intentional? As far as I can tell the difference is not documented.
The browserHistory used by React Router v2/3 uses history v3. The current master branch of history which you link to is v4 and is used by React Router v4.

React router hashHistory explained

Quote from here https://github.com/reactjs/react-router-tutorial/blob/master/lessons/02-rendering-a-route/README.md:
We're using hashHistory--it manages the routing history with the hash
portion of the url. It's got that extra junk to shim some behavior the
browser has natively when using real urls. We'll change this to use
real urls later and lose the junk, but for now, this works great
because it doesn't require any server-side configuration
Can someone please explain what this means ?
Is this something a begginner should understand ? (This seems to be a beginner tutorial.)
hashhistory simulates a nice url using the hash
symbol
example.com/#/some/path
while browserHistory uses History api to create an url like this one:
example.com/some/path
You can have a reference here: https://github.com/ReactTraining/react-router/blob/master/docs/guides/Histories.md

Polymer RESTful CRUD app

I have a Users resource that consumes and produces JSON.
I want to make RESTful calls (GET,POST,PUT,DELETE) in Polymer.
Any example app or link to resources.
I made this Polymer app for an Open Source domotic project:
https://github.com/NikZar/nautes-freedomotic-dashboard
You can take a look at my: fd-rest-element-service.html and see how it gets used in the application.
I hope this helps :)