4
retoor
43d

It's time for war!
I have two examples doing the same thing. They're bot generated by chatGPT.

React:
import React, { useState } from 'react';

function IncrementalButton() {
// Create state to hold the count value
const [count, setCount] = useState(0);

// Function to handle incrementing the count
const increment = () => {
setCount(count + 1);
};

return (
<div>
<h2>Count: {count}</h2>
<button onClick={increment}>Increment</button>
</div>
);
}

export default IncrementalButton;

VUE:

<template>
<div>
<h2>Count: {{ count }}</h2>
<button @click="increment">Increment</button>
</div>
</template>

<script>
export default {
data() {
return {
count: 0,
};
},
methods: {
increment() {
this.count++;
},
},
};
</script>

<style>
/* Add your CSS styles here if needed */
</style>

Whats better in your opinion?

Comments
  • 1
    @aviophile your opinion svp 😁
  • 2
    const pony = () => {
    // lala
    }
    Is just freaking
    function pony() {
    // lala.
    }

    What the fuck is wrong with those guys. It's fun and create but sigh..
  • 2
    setCount of react example is so weak..
  • 0
    @jestdotty there's some sick commercial company after it that wants you to host on their servers?

    I tried svelte btw. It's easy but I can't create something like vuetify when it comes to gui
  • 3
    @retoor idk I just find the syntax not insufferable

    the react people told me to reinstall my whole OS because I couldn't get their tutorial app to work. that's no way to make a package. it was their first suggestion. I also pointed out their tutorial site was incorrect in its documentation. nobody cares over there. so I don't care to learn it.

    haven't touched vue

    I liked pugjs way back when. I just built websites with jquery and jade (now called pugjs), then moved to svelte after and pugjs fell out of favor (it's just templating for html)
  • 3
    @jestdotty reinstall whole OS. Fuuuuck, never heard of docker?
  • 1
    i like two more
  • 1
    In this example, 2 definitely looks cleaner. But I’m torn between “this is cherry-picking because stateful items in react are ugly” and “why does state need to be so ugly in react?”
  • 1
    npm r --save react
  • 1
    import SwiftUI

    struct Counter: View {
    @State var count = 0
    var body: some View {
    Button {
    count += 1
    } label: {
    Text("Count: \(count)")
    }
    }
    }
  • 2
    Option 2, but I'd probably do it with Composition API. I like it more.

    Also, React sucks, fuck React. It made me angry the other day.
  • 1
    Why use a framework when you can just use a vanilla webcomponent to achieve the same with less overhead.
  • 1
    @Ranchonyx this code in the vanilla way is waaaaay more code. Shadowdom fuckery and stuff
  • 1
    @retoor Not wrong, but doesn't it "compile" down to the same expressions anyway?
  • 0
    @Ranchonyx probably, but native webcomponets are reallii hard. Try vue for fun. It is fun
  • 2
    @retoor make your own framework, with blackjack and hookers

    if something is long to write make a method... whoops fell down into making 100th js framework
  • 1
    @retoor This is beneath me!
Add Comment