✅ – Cansu – 11-43 Oct 30

Rendering array of elements?
Solution:
NOTHING WORKS
D
DAMACANSU536d 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
D
DAMACANSU536d ago
NOTHING WORKS
D
DAMACANSU536d 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
UU
Unknown User536d ago