ashwanikumarjha
Sun Feb 26 2023
As a Next.js app can be executed on both the server and the client side. When the app is rendered on the server, there is no access to the browser-specific features like localStorage, as it is a feature of the client-side browser environment.
So let's say, if we try to use localStorage in a Next.js app, we may encounter issues when the app is being server-side rendered.
To avoid this problem, we can check if localStorage is available before using it in our Next.js app.
This way, our app will only use localStorage when it is available, and avoid errors when it is not.
So let's say, if we try to use localStorage in a Next.js app, we may encounter issues when the app is being server-side rendered.
To avoid this problem, we can check if localStorage is available before using it in our Next.js app.
if(typeoflocalStorage!== 'undefined') {
// Use localStorage here
}
This way, our app will only use localStorage when it is available, and avoid errors when it is not.
sujay
Sat Feb 18 2023
Bring the suspended server to foreground using
And the server resumes
fg
command. Say the server is running and we want to install a package
1. Ctrl+Z
2. yarn add jsonwebtoken
3. fg
And the server resumes
syedsibtain
Mon Feb 13 2023
We handle navigation in Gatsby using the
This is because the
So in case of external links, we should prefer a simple
Also gatsby prefetches the linked pages by starting a low priority request over a link, when we take the mouse on it
Link
Component. So if we put both external and internal links in the Link
element, we receive the following warning in the console:External Link was detected in a link component. Use the link component only for internal links.
This is because the
Link
component is designed to interact with Gatsby's client-side navigation, which is better for single-page apps and uses the window.history
API to update the URL without reloading the entire page.So in case of external links, we should prefer a simple
a
tag and pass the href
attribute.Also gatsby prefetches the linked pages by starting a low priority request over a link, when we take the mouse on it
onMouseOver
, it makes the request high priority.ayushsrivastava
Mon Feb 13 2023
Difference between DOM element properties
•
•
•
clientWidth
clientHeight
, offsetWidth
offsetHeight
, scrollWidth
scrollHeight
•
clientWidth
/clientHeight
is the visual portion of box content, borders and scrollbars not included, but padding is included•
offsetWidth
/offsetHeight
is the size of visual box including borders. Can be calculated by adding width/height and padding and borders.•
scrollWidth
/scrollHeight
is the size of the box content, including the parts that are hidden outside the scrolling areaayushsrivastava
Fri Feb 10 2023
Linked Lists
Linked list are a
Why do we need Linked List?
• Arrays can store the similar data but they have an upper limit, we need to speculate the size of array in advance, and the allocated memory is generally equal to the speculated size of the array
• Inserting and deleting data in between of Array is tedious, but in case of Linked List if we have the head node we can traverse to any node through it and insert new node
Linked list are a
linear data
structure like arrays
. But unlike arrays they are not stored in a single place in memory. They are made up of connected nodes, where each node consists of data and address of the next node.Why do we need Linked List?
• Arrays can store the similar data but they have an upper limit, we need to speculate the size of array in advance, and the allocated memory is generally equal to the speculated size of the array
• Inserting and deleting data in between of Array is tedious, but in case of Linked List if we have the head node we can traverse to any node through it and insert new node
keshav.chakravarthy
Thu Feb 09 2023
Set log level carefully, because depending on the level some logs may never be passed to the backend and will be unavailable for future debugging.
vaibhav.yadav
Wed Feb 08 2023
We can use git shortlog instead of git log to group commits by author using --group=author option.
keshav.chakravarthy
Mon Feb 06 2023
we can pin specific docker image to use by tagging the commit SHA
build:
stage: build
image: docker@sha256:the_sha
services:
- docker:dind@sha256:the_sha
keshav.chakravarthy
Mon Feb 06 2023
To get help on gitlab CI the forum link is forum.gitlab.com
iffyuva
Mon Jan 23 2023
Shopify has released LSP for Ruby which has been quite stable for sometime https://github.com/Shopify/ruby-lsp
Showing 38 to 40 of 73 results