File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
website/src/theme/sections/showcase-grid Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,12 @@ export default function ShowcaseGrid() {
9494 } ,
9595 ] ) ;
9696
97+ // https://reactjs.org/docs/react-dom.html#hydrate
98+ const [ isClient , setIsClient ] = useState ( false ) ;
99+ useEffect ( ( ) => {
100+ setIsClient ( true )
101+ } , [ ] ) ;
102+
97103 const items = itemsData . map ( ( item , index ) => {
98104 const {
99105 image,
@@ -130,8 +136,9 @@ export default function ShowcaseGrid() {
130136 )
131137 } ) ;
132138
139+ /* key={isClient ? 1 : 2} will trigger a rerender of the whole subtree and the images will be aligned with text */
133140 return (
134- < div className = { component } >
141+ < div className = { component } key = { isClient ? 1 : 2 } >
135142 < Container
136143 componentClass = { component }
137144 >
You can’t perform that action at this time.
0 commit comments