DAMACANSU
DAMACANSU3y ago

✅ – Cansu – 11-43 Oct 30

Rendering array of elements?
Solution:
NOTHING WORKS
Jump to solution
5 Replies
DAMACANSU
DAMACANSUOP3y ago
How can I render an array like that?
render() {
return (
<Fragment>
VALUE:{" "}
{this.dataHTML.map((item, index) => (
<div>{this.dataHTML[index]}</div>
))}
</Fragment>
)
};
render() {
return (
<Fragment>
VALUE:{" "}
{this.dataHTML.map((item, index) => (
<div>{this.dataHTML[index]}</div>
))}
</Fragment>
)
};
horribly fails
dataFromServer: any[] = [];
dataHTML: any[] = [];
dataFromServer: any[] = [];
dataHTML: any[] = [];
is just any arrays. outputting an array shouldnt be this hard. why cant I just do
var caner = [1,2,3,4,5]
for (int i=1; i<len(caner); i++){printf(caner[i])}
var caner = [1,2,3,4,5]
for (int i=1; i<len(caner); i++){printf(caner[i])}
ANANIN AMINA KOYAYIM I TRIED EVERYTHING PLEASE HELP ME BEFORE I GO INSANE. i tried this
render() {
return (
<div>
{this.dataFromServer.map((index) => <li>{index}</li>)}
</div>
);
};
render() {
return (
<div>
{this.dataFromServer.map((index) => <li>{index}</li>)}
</div>
);
};
i tried this
dataFromServer: string[] = [];
dataFromServer: string[] = [];
changed this then I changed this to
dataFromServer: JSX.Element[] = [];
dataFromServer: JSX.Element[] = [];
after that I changed render to
render() {
return (
<div>
{this.dataFromServer}
</div>
);
};
render() {
return (
<div>
{this.dataFromServer}
</div>
);
};
, and get message to
this.ws.onmessage = msg => {
const message = msg.data;
this.dataFromServer.push(<h1> message </h1>);
console.log(this.dataFromServer);
}
this.ws.onmessage = msg => {
const message = msg.data;
this.dataFromServer.push(<h1> message </h1>);
console.log(this.dataFromServer);
}
Solution
DAMACANSU
DAMACANSU3y ago
NOTHING WORKS
DAMACANSU
DAMACANSUOP3y ago
this is a two line job in GoLang, fuck me i will go to sleep this is just a mess and waste of time i will wait for an alternative to javascript and react at frontend
reactibot
reactibot3y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1036243938480230411
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/902647189120118794/1036243938480230411 Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question: https://stackoverflow.com/help/how-to-ask http://wp.me/p2oIwo-26