Comments (3)
Hello @pedrohasf!
I did not understand the issue, why would it not go throught the setSearchValue? The fireEvent.changeText should trigger the onChangeText
on the input, and by that you could update the searchValue by calling the setSearchValue.
Upon calling the setSearchValue you would also trigger the useEffect, by adding the searchValue in it's dependency array.
If you could give us code examples, or a little video showing the problem happening we should be able to see if the problem is something else.
from bootcamp-gostack-desafios.
Hello @josepholiveira
My useEffect function is as follow:
useEffect(() => {
async function loadFoods(): Promise<void> {
if (searchValue && !selectedCategory) {
const response = await api.get(`foods?name_like=${searchValue}`);
setFoods(response.data);
return;
}
if (selectedCategory && !searchValue.length) {
const response = await api.get(
`foods?category_like=${selectedCategory}`,
);
setFoods(response.data);
return;
}
if (searchValue.length && selectedCategory) {
const response = await api.get(
`foods?name_like=${searchValue}&category_like=${selectedCategory}`,
);
setFoods(response.data);
return;
}
if (!searchValue.length && !selectedCategory) {
const response = await api.get('foods?name_like=');
setFoods(response.data);
}
}
loadFoods();
}, [selectedCategory, searchValue]);
I have debugged and i saw that the variable searchValue on testing reaches the useEfffect function but with its value as an empty string and not as 'Ao molho' as the test needed it to be. I am not entirely certain that this is the problem but i believe it is, for searchValue to be an empty string it must not have been through setSearchValue.
Thanks for the support.
from bootcamp-gostack-desafios.
Could you upload your code to github or message me on discord so i can take a better look at it?
Testing in my code returned me the correct searchValue, and i would like to take a look at it. My discord user is DOGIM#0985
.
from bootcamp-gostack-desafios.
Related Issues (20)
- Desafio 07: GoFinances Web - Erro na descrição HOT 1
- Desafio 07: GoFinances Web - Erro na instalação dos pacotes HOT 1
- Desafio 09 - ESLint not working properly
- Desafio 02: NodeJS - Erro na descrição ou no teste "should be able to give a like to the repository" HOT 1
- Desafio 07: GoFinances Web - Erro na descrição HOT 1
- Desafio 06: Function uuid_generate_v4() does not exists HOT 23
- Desafio 03: detectando alteração no repositories após delete() HOT 1
- Desafio06 - Database Upload
- Correção nos textos sobre testes HOT 2
- MMD
- Desafio 07: GoFinances Web - Many-to-one / one-to-many relations
- Um sugestão para o desafio 10.
- Link para LICENSE não existe HOT 1
- English: can we replace 'food' with 'dish'? (DESAFIO 10)
- ✅ My challenge resolution: nodejs concepts
- Desafio 06 - Adição de condição dos testes
- Capitalização do Comentário // Todo
- Tornar este repositório um Template HOT 2
- Tr
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootcamp-gostack-desafios.