Answer the question
In order to leave comments, you need to log in
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
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.js
change value={bookStoreService} data={data}
to value={{ bookStoreService, data }}
, and in with-bookstore-service.js
change (bookStoreService, data)
to ({ bookStoreService, data })
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question