You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our React Hooks currently return a number of different kinds of values:
Network returns a string of 2g/3g/4g etc.
Hardware concurrency returns an integer for the number of cores
Memory returns a boolean of whether you are overloaded
Battery returns a float value . (e.g 0.75)
Device class returns a string for light/heavy
Of these values, memory stands out as a hook where we (project authors) are making a decision about what is overloaded. For all the other hooks, we just give developers the value and let them make a decision themselves.
For consistency, we should rewrite the memory hook to just provide a value from navigator.deviceMemory and optionally provide access to performance memory data, but assume the deviceMemory value is the main thing developers are after here.
Our React Hooks currently return a number of different kinds of values:
string
of 2g/3g/4g etc.integer
for the number of coresboolean
of whether you are overloadedfloat
value . (e.g 0.75)string
for light/heavyOf these values, memory stands out as a hook where we (project authors) are making a decision about what is overloaded. For all the other hooks, we just give developers the value and let them make a decision themselves.
For consistency, we should rewrite the memory hook to just provide a value from
navigator.deviceMemory
and optionally provide access to performance memory data, but assume the deviceMemory value is the main thing developers are after here.cc @anton-karlovskiy
The text was updated successfully, but these errors were encountered: