AGENGA:
- Một vài lưu ý chung
- Ôn tập kiến thức JS/ReactJS
- Cày thuật toán, giải thuật
- Tìm hiểu về công ty mà mình xin ứng tuyển
| import React from 'react'; | |
| import { withErrorBoundary } from 'components/common/MartyErrorBoundary'; | |
| export const ExampleComponent = () => { | |
| return ( | |
| <div> | |
| Component | |
| </div> | |
| ); |
| const pendingFns = {}; | |
| const runOnce = (fn, key) => { | |
| if (!pendingFns[key]) { | |
| pendingFns[key] = new Promise((resolve, reject) => { | |
| fn().then(resolve).catch(reject) | |
| }) | |
| } | |
| return pendingFns[key]; | |
| } |
| const Test = lazyLoadHydrate( | |
| () => import('@components/Test/Test'), | |
| true, | |
| () => <div style={{ height: 300 }} />, | |
| ); |
Cách cơ bản: Dùng svg qua thẻ img hoặc là dùng content của svg trong html
Cách tiếp cận tiếp theo là chuyển hết svg icon thành một bộ font rồi load bộ font,css đó vào source code, sử dùng bên html chỉ cần thêm class của icon.
Cách tiếp theo là chỉ cần chuyển svg thành dataURI rồi dùng trong css, bên html sẽ thêm class icon
HTML
| *, | |
| *::before, | |
| *::after { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| :where([hidden]:not([hidden='until-found'])) { | |
| display: none !important; |
| //@ts-nocheck | |
| import { exec } from 'node:child_process'; | |
| import fs from 'node:fs'; | |
| import inquirer from 'inquirer'; | |
| /** | |
| * @returns { Promise<string> } | |
| */ | |
| const chooseComponentDirectory = async ( |
| // npm i @babel/parser @babel/traverse -D | |
| const fs = require('node:fs'); | |
| const path = require('node:path'); | |
| const traverse = require('@babel/traverse').default; | |
| const parser = require('@babel/parser'); | |
| // Change dir folder |
| import { useEffect, useState } from "react"; | |
| interface LocationOptions { | |
| enableHighAccuracy?: boolean; | |
| timeout?: number; | |
| maximumAge?: number; | |
| } | |
| interface LocationState { | |
| coords: { |
| FROM node:18-alpine AS base | |
| # Install dependencies only when needed | |
| FROM base AS deps | |
| # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | |
| RUN apk add --no-cache libc6-compat |