Y
Y
yumakaev2019-12-14 20:13:56
React
yumakaev, 2019-12-14 20:13:56

Why are props not showing up?

Good evening, I'm trying to pass the variable "data" through "", but for some reason I get undefined
In index.js - I create data - HelloWorld, I give it to the provider
In /hoc/with-bookstore-service.js/ I process data
In the app. js I'm trying to output from props dat'y to the console, but I get undefined
https://codesandbox.io/s/confident-knuth-pmlu8

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-12-14
@yumakaev

You are obviously doing something wrong, data should be passed through value. If you want to transfer several values ​​- collect them into one object, you don’t need to invent your own props.
So in index.jschange value={bookStoreService} data={data}to value={{ bookStoreService, data }}, and in with-bookstore-service.jschange (bookStoreService, data)to ({ bookStoreService, data }).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question