File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1- import { useContext , useState , useEffect } from 'react'
1+ import { useContext , useState , useEffect , useLayoutEffect } from 'react'
22import { useHistory } from 'react-router-dom'
33import Snippet from '../../../Components/Snippet'
44import { getFriendSnippets } from '../../../API/apiData'
55import { UserContext } from '../User'
66import { DataContext } from '../../../App'
7+ import hljs from 'highlight.js' ;
78
89export default function View ( { friendFilter, setFriendFilter } ) {
910 const { userData, friendsList } = useContext ( UserContext )
@@ -37,6 +38,10 @@ export default function View({ friendFilter, setFriendFilter }) {
3738 setFriendFilter ( '' )
3839 } , [ setFriendFilter , history ] )
3940
41+ useLayoutEffect ( ( ) => {
42+ hljs . highlightAll ( )
43+ } , [ friendSnippetData , friendFilter , search ] )
44+
4045 return (
4146 < div className = "mt-4 sm:mt-0 sm:ml-2" >
4247 { userData . friends . length ? < > < h1 className = "ml-6 sm:ml-0 text-lg sm:text-2xl font-bold" > { friendFilter ? `${ userData . friends . find ( friend => friend . _id === friendFilter ) . firstName } 's Shared Snippets` : "All Shared Snippets" } </ h1 >
You can’t perform that action at this time.
0 commit comments