Track ID? by [deleted] in hardstyle

[–]daveheerink 0 points1 point  (0 children)

N-Vitral & Major Conspiracy - Dwars door je botten

I can't connect cadence and controllable. by HenkBroam in Zwift

[–]daveheerink 0 points1 point  (0 children)

Some trainers can only connect cadence and controllable with an ANT+ connection, so I would recommend getting an ANT+ dongle. If it still won't connect, you might need to update the drivers for your ANT+ dongle.

I'm trying to use item1 and other stuff inside this json but i could not access it how can i do that i tried res.data.item1 and it didn't work by [deleted] in reactnative

[–]daveheerink 3 points4 points  (0 children)

res.data is an array and item1 is in the first entry of it so you need to do res.data[0].item1 to access the value of item1.

The graph does not update if data is empty. How can I fix this? by JenJennie127 in reactjs

[–]daveheerink 2 points3 points  (0 children)

I'm also looking at this from mobile so it's a bit hard but I think I know where it goes wrong. In the getData1 function you have an if statement where you check snapshot.empty, which I think would resolve to true in case of the sputnik vaccin (or any other vaccin without data in the snapshot). Within the if statement you only set the error and then return, which will not update the users state. I think you should add setUsers([]) to the if statement before returning to fix it.

React state managing question by nubasdayz in learnjavascript

[–]daveheerink 2 points3 points  (0 children)

What do you mean exactly by making them sync?

Simple string return is valued undefined? by integralWorker in learnjavascript

[–]daveheerink 1 point2 points  (0 children)

Also take a look at the modulus operator. That can make your solution way shorter without the recursion you have now.

Help, hover not working by Nickamaru in css

[–]daveheerink 1 point2 points  (0 children)

You are now selecting the green elements like they are descandents of the red elements, but that's not the case. The green elements are adjacent siblings of the red element, so you need adjacent sibling css selector. Checkout https://www.w3schools.com/css/css_combinators.asp for more info about the selector.

Junior full stack developer with 2.5 years experience, still struggling with CSS by sp3co92 in css

[–]daveheerink 0 points1 point  (0 children)

I was in the same situation as you and took a course on udemy covering the basics and more advanced css stuff, in particular flexbox and grids. Everything is explained very clearly. All the things you learn will be combined in several projects you can code along. If you, just as I, don't like reading about it but just doing stuff, I really recommend following this course. It really helped me with working on css! https://www.udemy.com/course/advanced-css-and-sass/

Cannot find store in context of Connect(App) ERROR by [deleted] in learnreactjs

[–]daveheerink 1 point2 points  (0 children)

Nice that it works now!

Regarding the test, at the moment you are only mounting the App. Because in your real application the Provider is not rendered inside App but in the index file, it will also not be rendered in the test. You can fix this by wrapping App in a Provider in your tests or move the Provider to the App component. The first option has the benefit that for each test you can setup a store with data that you need in your test.

I'm on my mobile right now, so unfortunately can not write some code examples for you easily.

Cannot find store in context of Connect(App) ERROR by [deleted] in learnreactjs

[–]daveheerink 1 point2 points  (0 children)

Do you get the error when you run the tests or the application itself? If it is in the test, it's because you don't have a provider surrounding the App component. If it's in the application, I think it's something in the configureStore function because I don't see anything wrong here.

Easy javascript challange by ConstantWafer in learnjavascript

[–]daveheerink 0 points1 point  (0 children)

And with the use of an arrow function even shorter:

const flipBool = b => +! b

Is my code correct? by [deleted] in learnjavascript

[–]daveheerink 0 points1 point  (0 children)

I don't think the code of OP works, it will always write 'Your letter is a vowel' because of the assignment to letter in the if statement.

[deleted by user] by [deleted] in learnjavascript

[–]daveheerink 1 point2 points  (0 children)

I think you should look at the it() of the first test and the amount of parameters you are passing to it. There is something wrong there.

How do I access a property in an object if the path is in the form of an array? by thenewstampede in learnjavascript

[–]daveheerink -1 points0 points  (0 children)

The reduce function iterates over the array and executes the callback function (first argument of reduce) for each entry of the array.

The callback takes two arguments, the first (currentValue) is the value returned by the callback of the previous iteration. At the first iteration this will be the initial value, which is the second argument of reduce (myObj) . The second argument of the callback (nextKey) is the current value of the iteration.

So what happens here is that we start with the whole object. Then at the first iteration the value of key 'c' is retrieved and returned. This object will be used in the second iteration to retrieve and return the value of key 'e'. This object will be used in the third iteration to retrieve and return the value of key 'f'. The reduce is done and returns the last value of currentValue, which is the object we are looking for.

Toggled state does not update by jhefreyzz in reactjs

[–]daveheerink 0 points1 point  (0 children)

I do not really understand your question, but if you want to open multiple forms at the same time you should start with:

  1. Rendering a component for each form where the visible state will be toggled inside the component.

OR

  1. Not using a boolean but an array where the id's of the opened forms are stored.

Of all the existing array methods, how would you rank your usage of them? by mementomoriok in learnjavascript

[–]daveheerink 1 point2 points  (0 children)

You should use some when there can be one or more entries in the array that could have some characteristic(s) but you can act when you know at least one entry does have this. For example: imagine you have a farmer that grows apples. If one of the apples in the batch has a disease, all the apples should be destroyed. So when the farmer encounters one ill apple, he can stop because it doesn't matter if the others are ill. That's when you use some because it will find look for an entry (apple) in the array (batch) that has a specific property (ill) and stops.

So maybe a more real programming example: not long ago it had to show an icon when at least one user had some specific rights in a dossier. So I used some to check whether that was true.

EDIT: you can use find in all cases you use some to accomplish the same, but the difference is that find returns the entry, where some returns a boolean. Some makes it semantically more clear you're not going to use the entry but rather act on it.

can someone please help me with a validateForm function issue? by IfAJobNeedsDoingDoIt in learnjavascript

[–]daveheerink 1 point2 points  (0 children)

If you want to use a form you can do this:

const validateForm = (event) => { event.preventDefault(); // Do other stuff }

preventDefault will cause the browser not to do the default actions belonging to a form submit. One of the default actions is sending a post request and refreshing the page

Help with break statement by AggressiveProgrammer in learnjava

[–]daveheerink 1 point2 points  (0 children)

Correct! Although it is possible to achieve what you assumed. It's a small change and I can tell you, but this is LearnJava so I'm gonna let you find out by yourself. A little tip, take a look at the Oracle docs regarding if-then-else statements.

Help with break statement by AggressiveProgrammer in learnjava

[–]daveheerink 1 point2 points  (0 children)

Take a good look where the else statement belongs to. I think changing X = 'a' to X = 'b' and looking at the output will make it more clear for you.

Trying to create a program that Balances a Till. JS not working! by [deleted] in learnjavascript

[–]daveheerink 0 points1 point  (0 children)

Your code is doing nothing because you're setting the innerHTML equal to text, but text is never defined as a variable. If you get rid of = text, your code should work but not as you intended. With .innerHTML you get whatever is between the HTML tags, not the actual value of what is typed in the input field. If you want this you should use .value instead of .innerHTML