Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F87120866
ContextProvider.md
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Oct 10, 18:35
Size
894 B
Mime Type
text/x-java
Expires
Sat, Oct 12, 18:35 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
21539605
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
ContextProvider.md
View Options
###
Context
Provider
Description
Context
provides
a
way
to
pass
data
through
the
component
tree
without
having
to
pass
props
down
manually
at
every
level
.
[
React
Context
Documentation
](
https
:
//reactjs.org/docs/context.html)
###
Context
Provider
exemple
to
access
the
context
Hook
```
js
static
import
React
,
{
useContext
}
from
'
react
'
;
import
{
Context
}
from
"../ContextProvider"
//call the custom hook to share the state between different level componant
const
{
getSelectedInstitId
,
getSelectedJournalId
,
getSelectedFunderId
,
institList
,
journalList
,
funderList
,
institId
,
journalId
,
funderId
,
setInstitId
,
setJournalId
,
setFunderId
,
url
}
=
useContext
(
Context
)
```
Any
[
Markdown
](
http
:
//daringfireball.net/projects/markdown/) is **allowed** _here_.
Event Timeline
Log In to Comment