Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VCCI-News
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Văn Hoàng
VCCI-News
Commits
724f942d
Commit
724f942d
authored
Jan 06, 2026
by
Phạm Quang Bảo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update/image next
parent
715302d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
index.tsx
src/components/shared/image-next/index.tsx
+7
-3
No files found.
src/components/shared/image-next/index.tsx
View file @
724f942d
import
Image
from
"next/image"
;
import
{
useState
}
from
"react"
;
import
{
use
Effect
,
use
State
}
from
"react"
;
const
ImageNext
=
({
src
,
alt
,
width
,
height
,
className
,
onError
}:
any
)
=>
{
const
ImageNext
=
({
src
,
alt
,
width
,
height
,
className
,
fallback
=
"/img-error.png"
}:
any
)
=>
{
const
[
imgSrc
,
setImgSrc
]
=
useState
(
src
);
useEffect
(()
=>
{
setImgSrc
(
src
);
},
[
src
]);
return
(
<
Image
src=
{
imgSrc
}
...
...
@@ -11,7 +15,7 @@ const ImageNext = ({ src, alt, width, height, className, onError }: any) => {
width=
{
width
}
height=
{
height
}
className=
{
className
}
onError=
{
()
=>
setImgSrc
(
onError
||
"/img-error.png"
)
}
onError=
{
()
=>
setImgSrc
(
fallback
)
}
unoptimized
/>
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment