This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Prerequisite: Basic knowledge about [React](https://reactjs.org/) and [Refs and the dom](https://reactjs.org/docs/refs-and-the-dom.html#callback-refs) in React | |
This post is going to talk about what is **useRef** hook and when we can use it. | |
The first time I learned Hooks, I have so many questions that I need to look for the answers. One of those questions is how I can compare the current state/props with the previous one or handle deep object comparison in **useEffect Hook**. I would only figure it out when I learned about **useRef Hook** then every pieces fall into place. | |
💪 Let's get started! | |
## 1. What is useRef hook? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Specify a base image | |
FROM node:alpine | |
WORKDIR /usr/app | |
# Install some dependencies | |
COPY ./package.json ./ | |
RUN npm install | |
COPY ./ ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dockerfile.dev | |
FROM node:alpine | |
WORKDIR '/app' | |
COPY package.json . | |
RUN npm install | |
COPY .. |