home page is done
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
import React from 'react';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
|
||||
const Chat = () => {
|
||||
const [interlocutorId, setInterlocutorId] = useState(0); // State to hold the interlocutorId
|
||||
|
||||
function getInterlocutorId() {
|
||||
const id = localStorage.getItem('interlocutorId');
|
||||
return id ? id : 0;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const id = getInterlocutorId();
|
||||
setInterlocutorId(id);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<h2>Chat with ...</h2>
|
||||
<h2>Chat with ... (id = {interlocutorId})</h2>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user