Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103590479
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
Mon, Mar 3, 05:16
Size
894 B
Mime Type
text/x-java
Expires
Wed, Mar 5, 05:16 (22 h, 58 m)
Engine
blob
Format
Raw Data
Handle
24543855
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