Shibawanko posted:i still don't understand why it kept working for the "top" value but not "bottom" when they have basically identical syntax In programming, "basically identical" !== "identical" :P
|
|
# ¿ Aug 16, 2022 13:35 |
|
|
# ¿ May 15, 2024 16:29 |
Shibawanko posted:so when it sees - and fails to cocatenate, it resorts to treating them like integers by default and therefore it still works? What would the semantics of code:
You can try all this out really easily in your browser console if you're curious. Or you can read big ol' articles like this one and try to cram it into your head. The basic lesson is to switch to TypeScript if you want your compiler to stop you from doing this kind of thing, or get really handy with debug logging and breakpoints to see what's messing you up.
|
|
# ¿ Aug 16, 2022 14:17 |
Peachfart posted:Not sure if this is the correct thread, but my work wants me to learn Javascript to work with some automation software, and I have always wanted to learn it. But I haven't done any programming since high school. Is there a recommended online resource for learning Javascript? Modern Javascript is pretty good. That said, I would heartily recommend using Typescript from the get-go if at all possible, since its typing lets you avoid a lot of really irritating pitfalls caused by Javascript's loose typing and enables automated refactoring.
|
|
# ¿ Sep 27, 2022 15:05 |
I feel like people starting afresh might be better off with Next rather than create-react-app since the dev environment is so much more pleasant.
|
|
# ¿ Dec 30, 2022 18:40 |
Vino posted:I'm having trouble figuring out coroutines. This is Typescript. I think you're trying to yield an undefined value - isn't that what 'yield' with no argument does?
|
|
# ¿ Sep 14, 2023 09:17 |
I would absolutely start with typescript, because strong typing is nice to have, especially when learning, since it helps guide your code, and makes exploring other code easier
|
|
# ¿ Oct 27, 2023 12:28 |
The problem there is more Jest than anything else, test with something else like mocha.
|
|
# ¿ Oct 28, 2023 13:27 |
Looping over 800 values is never enough to be something to cause the browser to be sluggish - you probably have some other expensive re-rendering in there. Either way, if you just keep the cards in an object keyed by id instead of an array, and replace them by going JavaScript code:
You can be sure that the issue isn't the updating.
|
|
# ¿ Jan 8, 2024 13:25 |
Oh no, it wasn't meant as a final solution, more as a way of checking whether the updating was the issue. Sorry if that wasn't clear. I was only addressing that part of your post. The point being to update something without creating a new object/reference. The real issue is of course like you said having a giant data blob as the root of state that causes everything to re-render if you're not careful. One main way to avoid unneccessary re-renders for child components is using useMemo where possible. Looks like splitAtom is also a really nice solution though, hiding the complexity.
|
|
# ¿ Jan 9, 2024 15:04 |
I think it's even clearer if you define the named outer function in the non-assignment way, like so:TypeScript code:
|
|
# ¿ Jan 23, 2024 14:19 |
You can also just use the gh-pages module to automate the whole thing on github pages from a single repo.
|
|
# ¿ Jan 27, 2024 11:50 |
So you're just doing this as an exercise right? Because otherwise Sequelize exists and mostly does what you want, I think?
|
|
# ¿ Mar 26, 2024 00:30 |
|
|
# ¿ May 15, 2024 16:29 |
I mean, in my opinion ORMs are cursed anyway, especially the ones that encourage active-record stuff. I think repository methods that do regular queries combined with proper result type checking with e.g. Zod are a cleaner way to interact with your DB, and have the added benefit of letting you already get out of db-land and into domain logic. That said, even if it's an exercise I think you could probably get more guidance on your path by peeking at the source code for Sequelize and Zod than from me trying to parse what you're doing and giving targeted advice. Either way, respect for trying something out and posting about it, it's interesting to read!
|
|
# ¿ Mar 26, 2024 14:44 |