export const destroyFns: Array<() => void> = [];
export const destroyAll = () => {
while (destroyFns.length) {
const close = destroyFns.pop();
if (close) {
close();
}
}
export interface ConfirmProps {
afterClose?: () => void;
onClickClose?: (
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
) => void;
onOk?: (
event:
| React.MouseEvent<HTMLButtonElement, MouseEvent>
const useModal = (
isVisible: boolean
): [
boolean,
React.Dispatch<React.SetStateAction<boolean>>,
(event: React.KeyboardEvent<any>) => void
] => {
const [isOpen, setIsOpen] = useState(isVisible);
interface Factory {
Component?: any;
onClosed?: () => void;
onAfterClosed?: () => void;
[x: string]: any;
}
export const factory = ({ Component, ...config }: Factory) => {
const div = document.createElement("div");
import "bootstrap/dist/css/bootstrap.min.css";
export default function confirm(config: ModalFuncProps) {
const div = document.createElement('div');
document.body.appendChild(div);
// eslint-disable-next-line no-use-before-define
let currentConfig = { ...config, close, visible: true } as any;
function render({ okText, cancelText, prefixCls, ...props }: any) {
/**
* https://github.com/ant-design/ant-design/issues/23623
const initialState: State = {
user: {
id: '',
nickname: '',
photoURL: '',
statusMessage: '',
},
deleteMode: false,
// ref를 주입받을 modal state입니다.
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
<head> | |
<title>threejs - basic setup</title> | |
</head> | |
<body> | |
<canvas id ="c"></canvas> | |
</body> |
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
캐시 | |
참고: https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=ko | |
1. CDN에서는 어떤 데이터를 캐시하는가? | |
api의 content-type에 따라서 (image, pdf, js, css, html 등등...) | |
주의: CDN이 데이터를 캐시하기 때문에 원하는 때에 최신화된 데이터가 오지 않올 수 있으므로 주의가 필요하다. | |
2. 어떻게 해야 캐시 데이터를 지정할 수 있는가? | |
HTTP 해더 설정 (ETag, Cache-Control) | |
참고: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 |
흔히 여러 컴포넌트를 거치지 않고 손쉽게 state를 전달하기 위해 혹은 분리해서 중앙화 하기 위해 Redux를 사용합니다. 하지만 이 state는 인터넷창의 새로고침 버튼을 누르거나 종료하는 순간 초기화 되고 맙니다. 초기화를 방지하기 위해서 흔히 Web storage(이하 storage라 지칭)에 저장하는데요. 이 것과 삭제 기능을 포함해서 Redux안에서 간편하게 하게 할 수 있는 라이브러리가 바로 Redux Persist입니다. 실제로 코드를 살펴보면 Redux store을 하나 더 만들어서 여기에 특정 state를 저장하고 특정 액션이 발동되면 직렬화(serialize)해서 storage에 저장, storage에서 역직렬화(deserialize)후 불러와 사용합니다.
1.먼저 기존의 Reducer에 persistConfig를 만들고 persistReducer함수로 감싼다.