I installed socket.io-client
dependency and when I tried to import it it gave me this error:
SyntaxError: Unexpected token '{'. import call expects exactly one argument
Here is the code:
import { io } from "socket.io-client";
const socket = io("http://localhost:3000");
function createNewMessage() {
const getInputById = document.getElementById("message_input");
const createSpan = document.createElement("p");
createSpan.innerHTML = getInputById.value;
createSpan.className = "message";
getInputById.value = "";
document
.getElementsByClassName("messanger_main_container")[0]
.appendChild(createSpan);
}
Any suggestions please?