Skip to content

Tag: reactjs

React change input value onChange

This is my SearchForm.js, handleKeywordsChange must handle input keywords changes The problem is input keywords doesn’t change its value when I’m typing. What’s wrong? Answer Make a common function for changing the state for input values. Make sure you mention name in every input tag. e.g:

ReactJS and Node — Error 400 bad request

I am trying to build a react application which saves data into database. I have the following classes: server.js and SaveNewCard.js But I got the following Bad Request 400 error: And: As I can understand, my request does not contain the inserted data… I assume the problem is here somewhere….: I le…

404 page in REACT

I created the component NotFound and it works fine when I go to a page that doesn’t exist. But the same page it’s appearing in all my pages, not only the one that doesn’t exist. This is the component: And this is how I used it in the main page: As you can see I use <Route path=”*&#8…

How to reset form radio buttons to unchecked in reactjs?

I have made 4 radio buttons for 1 question. I have made 2 buttons submit and clear input. When I submit the form after clicking on clear input it does not clear the checked buttons to unchecked how can I do that using reset function ? contactform.js: See screenshots: Answer Give a checked attribute for you ra…

asserting against thrown error objects in jest

I have a function which throws an object, how can I assert that the correct object is thrown in jest? https://repl.it/repls/FrayedViolentBoa Answer If you are looking to test the contents of a custom error (which I think is what you are trying to do). You could catch the error then perform an assertion afterw…

FlatList not scrolling

i have created a screen where I display a component that contains a FlatList. For some reason I can’t scroll through the list. Someone who can spot my mistake and point me in the right direction? render-function and style from my screen file: render function and style from my listitem component: render …

How to customize Ant.design styles

Who knows how to customize Ant.design styles in proper way? For example, I want to change the default backgroundColor and height of Header section: Is it ok, or there is a better way to customize styles? Because I have not found some component’s attributes or smth. like this. Answer Antd has externized …