DEV Community

Guru
Guru

Posted on

Hello Devs !!!

Hello Guys iam Guru a Self thought web developer currently in the phase of learning react js already it take's too much time to me
to understand the basics of react today iam learning about useEffects and i dont even know how to work with api's yeah it sounds like shit!! but yesss i dont know how to work with apis
but i realy have my full focused on my journey to be become a Full Stack web developer its my First Post in Dev Community any Way iam started put more focuse of my carrer from today.
while doing some of the projects i accedently did some simple counter but it only has one button for increse and decrese
i know it was not that much complicated for a medium level react learner or a pro in react but it was helpful in someways for a very new react biggner
here are my code's

import "./styles.css";
import { useState, useEffect } from "react";

export default function App() {
  const [count, setCount] = useState(0);
  const [isNeg, setIsNeg] = useState(false);

  const changeMode = () => {
    isNeg ? setCount((count) => count - 1) : setCount((count) => count + 1);
  };

  return (
    <div className="App">
      <div>
        <h1>{count}</h1>
        <button onClick={() => setIsNeg((value) => !value)}>
          change
        </button>
        <button onClick={changeMode}>{isNeg ? "+" : "-"}</button>
      </div>
    </div>
  );
}

Enter fullscreen mode Exit fullscreen mode

yes my English is soo much messy and not perfect but i correct that too and also iam looking for connect with web developers is any one intrested pls replay for this post
Thank You....

Top comments (2)

Collapse
 
oculus42 profile image
Samuel Rouse

Hello, and welcome!

When posting code samples, you can specify the type of code to get automatic code highlighting.

`​``javascript
import "./styles.css";
import { useState, useEffect } from "react";
``​`
Enter fullscreen mode Exit fullscreen mode

Will end up looking like this:

import "./styles.css";
import { useState, useEffect } from "react";
Enter fullscreen mode Exit fullscreen mode
Collapse
 
gurux3 profile image
Guru

Oh thank you sir ❤️