useMountedState always returns false
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start with the useMountedState entry point and run the supplied ThemeToggler example. Confirm whether the hook remains false after mounting, then collect the missing React and react-use versions and create a minimal reproduction. Done means the reported behavior and expected mounted-state result are clear enough for maintainers to investigate.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is the current behavior?
this always returns false, im doing something wrong ?
'use client';
import React from 'react';
import { useTheme } from 'next-themes';
import { Moon, Sun } from 'lucide-react';
import { Button } from './ui/button';
import { useMountedState } from 'react-use';
export const ThemeToggler = () => {
const { setTheme, theme } = useTheme();
const isMounted = useMountedState();
const isDark = theme === 'dark';
const Icon = isDark ? Moon : Sun;
const toggleTheme = () => {
setTheme(isDark ? 'light' : 'dark');
};
// isMounted() is always false here
if (!isMounted()) return null;
return (
<Button size={'icon'} variant={'ghost'} onClick={toggleTheme}>
<Icon size={24} />
</Button>
);
};
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have extra dependencies other than react-use. Paste the link to your JSFiddle or CodeSandbox example below:
What is the expected behavior?
A little about versions:
- OS:
- Browser (vendor and version):
- React:
react-use:- Did this worked in the previous package version?
- Ngôn ngữ chính
- TypeScript
- Star
- 44k
- Fork
- 3.3k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của streamich/react-use
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Add Generic Fn for useDebounceCó thể đã có người làm @itsmejay80 đã nhận 180 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
-
useVideo.story.tsx - sampleVideo can not be loadedCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
-
useSlider: event callbacks are not updatedCó thể đã có người làm @erykpiast đã nhận 1827 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Tất cả issue của streamich/react-use
Issue tương tự
-
[Bug]: Server git tests sign fixture commits with the developer's key when run from the repo rootĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
melgarafael/DeskcommCRM#2657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
MystenLabs/MemWal#1163 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
"Explore the letters"-button should read "Explore the papers"Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởMondriaan
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
knaw-huc/textannoviz#709 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
billion-context-pi
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ranxianglei/billion-context#2521 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày