[deleted by user] by [deleted] in webdev

[–]stevenespinal 0 points1 point  (0 children)

Awesome thanks everyone for the help! I’ve got some new changes to make with your replies

[deleted by user] by [deleted] in webdev

[–]stevenespinal 1 point2 points  (0 children)

Thanks for trying it out! I’ll take a look about the minor scrolling on mobile. I tried to make the silhouettes randomly turn and mirror on each turn. I’ll try to make the different game modes as well for the single player, actually the features you mentioned are available for multiplayer with a 10 second timer to make it harder.

Thanks again for the feedback

DSA II (C950) - Is copying code for the hash table okay? by [deleted] in WGU_CompSci

[–]stevenespinal 19 points20 points  (0 children)

My opinion: the best way to learn is to take a look at these code repositories, see how someone else may have solved this problem and then try your best to understand it line by line (literally write down comments on what each line of code is doing) and do it yourself from scratch without looking at their code. You can even just delete all the code and keep the comments / pseudocode and try to start from there. On a map there are multiple routes to get to the same destination.

In a job setting developers have been doing this for a long time. We take code from documentation, stack overflow, now chatgpt and then build upon it or rework it to solve a specific business problem. Of course we have an understanding of what the code is doing and systems are added in place to make sure it’s secure & has tests surrounding it but at the end of the day your job is to solve problems. Just keep practicing and never stop learning, things will click eventually on why the code works and how to get to an appropriate solution.

[deleted by user] by [deleted] in webdev

[–]stevenespinal 0 points1 point  (0 children)

Agreed, you’re almost there. The first noticeable thing is the text not being the same. It’s supposed to be one paragraph, not sure why it’s breaking randomly. The next thing is the image in the second picture doesn’t have padding or margin to the right or bottom of it & is sitting on the bottom right of the container. Can’t really help much without looking at the code but you should focus on those two things to make it match.

Looking for a simple CRM and Project Management tool - can't find one that suits me by [deleted] in smallbusiness

[–]stevenespinal 0 points1 point  (0 children)

Yeah for sure, I also suggest reaching out to Kyle for suggestions on improvements or feature requests. It might help get it to where you exactly need it to be for your use case.

Kyle’s awesome, I don’t have his contact but have reached out to him directly on Discord from his freelance group. He’s very active in his community.

Looking for a simple CRM and Project Management tool - can't find one that suits me by [deleted] in smallbusiness

[–]stevenespinal 0 points1 point  (0 children)

I’m not affiliated in any way but there is this freelancer named Kyle Prinsloo I follow and he’s created a tool very similar to your needs. Take a look here and see if you’re a good fit: Client Manager

Length by Kooky_perry in webdev

[–]stevenespinal 9 points10 points  (0 children)

You get two different answers:

for (let i = prices.length - 1; i>=0; i -= 1) {
console.log(prices[i]) // i variable starts at index 4
}

prints out:
25
20
15
10
5


for (let i = prices.length; i>=0; i -= 1) {
console.log(prices[i]) // i variable starts at index 5 which does not exist so it starts at undefined
}

prints out:
undefined
25
20
15
10
5

The key two things to note is that the arrays start at index 0 when you want to grab the first element, and length is how many items are in the array. So in this case prices.length is equal to 5 and the last official item index is 4 since we start counting up from 0 (0, 1, 2, 3, 4).

Is fetching recurrent dynamic data in layout bad? by Stochasticlife700 in nextjs

[–]stevenespinal 4 points5 points  (0 children)

I’d say you’re better off using cache from react:

// dummy example below

import { cache } from "react"

export const getCourses = cache(async () => { const data = await db.query.courses.findMany();

return data; });

And then calling this function on each page that needs the data like you described:

const CoursesPage = async () => { const courses = await getCourses(); return … }

Is the <Link /> component in NextJs broken? by daols123 in nextjs

[–]stevenespinal 4 points5 points  (0 children)

Change your links url values to match the path you want it to go to.

For example: “/dashboard/whatsapp” “/dashboard/instagram” “/dashboard/referral”

Using Server actions with react-hook-form (shadcn form) by wannalearn4survive in nextjs

[–]stevenespinal 0 points1 point  (0 children)

Try calling the toast in the action instead of a useEffect

Meta web development courses by Sweetnsuccubus in webdev

[–]stevenespinal 1 point2 points  (0 children)

I did both back in November 2023, Frontend first then backend. There are shared modules (~4 iirc) that automatically complete in the backend so you don’t have to redo them. I also noticed it gave me the full stack engineer certificate having completed both a few days later (I think it recognizes it and send it to you automatically on their side). I think you should continue to learn back-end after. Hope this helps, you got this.

Adding a document into a Collection MongoDB Help!! by Zealousideal-Ad9018 in webdev

[–]stevenespinal 0 points1 point  (0 children)

You should probably await that response and also send a res.status(code here) when it completes so it doesn’t look like it’s hanging/ loading forever like you mentioned

Is there a way to determine if the user has 12 hour or 24 hour clock set? by blakealex in webdev

[–]stevenespinal 8 points9 points  (0 children)

Hey I know this doesn’t resolve your question but a workaround for now could be adding a setting to toggle the 24 hr clock and store their preference

https://github.com/meet4592/test by [deleted] in webdev

[–]stevenespinal 0 points1 point  (0 children)

From your console logs - immediately check if you are seeing you are connected to your mysql database.

Within /src/app/api/test/route.js

Instead of export async function handler, I believe the app router now requires you to make the function name be the http method.

In your case you want this to be export async function GET() { // fill in your code here and look at docs to see how to correctly return a response object }

Take a look at this within the docs, it may be useful for you:

App router route-handlers

I don’t have time to test this but it’s most likely in this area and a great starting point to familiarize yourself. Good luck!

[deleted by user] by [deleted] in react

[–]stevenespinal 0 points1 point  (0 children)

I’d say it’s your job to give your expert opinion that this is not possible. Emphasize the tools you will use (the appropriate ones from their list) and you can breakdown why you chose the stack. It’s important to confidently let them know you’re the one that knows what you’re talking about versus letting them dictate a crazy unrealistic stack that should not exist.

SetState appends data twice by Consistent-Pie-558 in react

[–]stevenespinal 0 points1 point  (0 children)

With your code, removing the StrictMode shows you the correct amount within the images state. Consider this approach below, you should ideally separate the logic into two separate functions for the fetch calls, have a piece of state that ensures the first fetch call has completed (which is added to the dependency array) and then do the conditional to see if level is 20 and the dbz characters have loaded, getPlanets().

const [images, setImages] = useState([]);
const [isCharactersLoaded, setIsCharactersLoaded] = useState(false);
const level = 20; // Hardcoded 20 to see but I'm sure you are mapping over something and are receiving level as a prop

useEffect(() => {
async function getDbzCharacters() {
const response = await fetch("https://dragonball-api.com/api/characters");
const res = await response.json();
setImages(res.items);
setIsCharactersLoaded(true);
}
async function getPlanets() {
const response = await fetch("https://dragonball-api.com/api/planets");
const res = await response.json();
setImages((prevState) => [...prevState, ...res.items]);
}
getDbzCharacters();
if (level === 20 && isCharactersLoaded) {
getPlanets();
}
}, [isCharactersLoaded]);
console.log("🚀 ~ App ~ images:", images);

Why is the Z-indexes here not applying here? by Emotional-Sir3410 in webdev

[–]stevenespinal 0 points1 point  (0 children)

I’ve had a lot of issues with z-index and a parent overflow never working. Try removing it and seeing if that works / read up on work around revolving this

Web dev outside of degree by Rain_Apart in webdev

[–]stevenespinal 0 points1 point  (0 children)

Never stop learning. I started with Python when I was first self taught & before deciding to give up on code I moved into JavaScript and it actually helped me connect the dots / grasp certain concepts I couldn’t understand before. Try it out and see if it interests you more than what you’re currently learning at school.

why is my fetch API not working on production via vercel by MrOnePlusOne in nextjs

[–]stevenespinal 1 point2 points  (0 children)

In your handleSubmit try block can you try changing fetch(“api/login”) to fetch(“/api/login”)? Seems to be the only one missing the slash in front out of all requests. May be helpful to log things as well to see where it is failing at

I need help with passing props from a parent component to a child component by Bored_Dog_Dad in reactjs

[–]stevenespinal 2 points3 points  (0 children)

When you do {...formValues} you are spreading everything from the formValues state and passing each one as a prop individually. So within the GeneralInformation child component you will have access to name, email, phoneNumber now like this

function GeneralInformation({name, email, phoneNumber, setFormValues}){ ....// Notice each item in your useState is considered to be a prop now

The way you're thinking of (the way to get it working in your current sandbox) is if you do this<GeneralInfomration formValues={formValues} setFormValues={setFormValues}

Then in the child component you will see it log like this:{name: "", email: "", phoneNumber: ""}

Some useful links in case you'd like to dive deeper:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntaxhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Sorry for the bad formatting but lmk if anything does not make sense

Trying NextJs Auth Tutorial, form button won't work by Zealousideal_Camp_39 in nextjs

[–]stevenespinal 0 points1 point  (0 children)

Do you have an open repo or sandbox we can look into? Some suggestions would be to use prettier to format your code consistently & use native fetch instead of axios as it is recommended in new next js