-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export SitecoreContextReactContext #224
Comments
Longer term would it be a better solution to export a custom hook to expose this that wrapped |
Yes for the longer term a custom hook would be better. |
I did some basic tests and that change looks valid. The associated pull request has been merged. |
* Added support for TypeScript when 'jss build'ing * Type-hint field value. * Update dataModels.ts * Move type hint to Field. * Type-lock return value when defaultValue provided. * Fix to copy host style attribute to its children dynamic components * changed spacing * updates for ssr * Add loader for lazy loaded components * Add some documentation * Placeholder loading component * Use ng-template instead of ng-content * Fix typo * Export SitecoreContextReactContext See #224 * WIP: simple http listener that accepts JSS view engine args, performs SSR, and returns result to caller. * Moved JSS rendering host to separate package. * SUGCON demo prep * Removed unnecessary console.log statements from htmlTemplateFactory.js * Changed `start:http-renderer` script name to `start:rendering-host` * Demo content for content block component. * Changed `sc_renderengineurl` querystring key to the CORRECT `sc_httprenderengineurl`. doh, smh. * Incorporating `defaultAppInvocationInfoResolver` into the renderingHostServer startup script. * removed static `jss` subdomain for ngrok tunnel * Fixing tests * #61 Nested component definitions via Item Link returns only IDs * Upgrade dependencies with critical and high security issues (#252) Upgrade dependencies * Upgrade cypress * downgrade dependency version * Feature/356383 (#256) Upgrade sitecore-jss-react package dependencies * remove InferProps (#259) remove InferProps * Feature/356379 (#265) * update react sample dependencies * update dependencies and fix ts errors (#266) Upgrade Vue package dependencies * #267 Error in description of one of methods of Manifest interface * Upgrade Vue sample (#269) Upgrade Vue sample * Feature/356380: Update Angular * Upgrade jss-angular and jss-angular-schematics and jss-sample-app * Feature/356378 (#272) Upgrade CLI Packages Upgrade CLI Packages * Use Object.entries instead of Object.keys (#274) Use Object.entries instead of Object.keys * mediaApi.updateImageUrl loses revision querystring (#275) mediaApi.updateImageUrl loses revision querystring * DevTools loading hidden files and crashing (#276) * Feature/356373 (#273) Node Proxy: CURL URL -IL returns 500 OK Node Proxy: CURL URL -IL returns 500 OK * change logo (#279) change logo * upgrade react-native sample (#282) upgrade react-native sample * [React-Native] Extend Image component to render svg images (#283) * add react-native-svg to sample app * update react-native package-lock * add react-native-svg to sitecore-jss-react-native * #348713Explicitly state that field names are not affected by the serialization configuration on Layout Service (#284) * #348713 Explicitly state that field names are not affected by the serialization configuration on Layout Service * #348713 Update * Extended a CD server setup instructions (#286) * React native sample app (#291) React native sample app
* Added support for TypeScript when 'jss build'ing * Type-hint field value. * Update dataModels.ts * Move type hint to Field. * Type-lock return value when defaultValue provided. * Fix to copy host style attribute to its children dynamic components * changed spacing * updates for ssr * Add loader for lazy loaded components * Add some documentation * Placeholder loading component * Use ng-template instead of ng-content * Fix typo * Export SitecoreContextReactContext See Sitecore/jss#224 * WIP: simple http listener that accepts JSS view engine args, performs SSR, and returns result to caller. * Moved JSS rendering host to separate package. * SUGCON demo prep * Removed unnecessary console.log statements from htmlTemplateFactory.js * Changed `start:http-renderer` script name to `start:rendering-host` * Demo content for content block component. * Changed `sc_renderengineurl` querystring key to the CORRECT `sc_httprenderengineurl`. doh, smh. * Incorporating `defaultAppInvocationInfoResolver` into the renderingHostServer startup script. * removed static `jss` subdomain for ngrok tunnel * Fixing tests * #61 Nested component definitions via Item Link returns only IDs * Upgrade dependencies with critical and high security issues (#252) Upgrade dependencies * Upgrade cypress * downgrade dependency version * Feature/356383 (#256) Upgrade sitecore-jss-react package dependencies * remove InferProps (#259) remove InferProps * Feature/356379 (#265) * update react sample dependencies * update dependencies and fix ts errors (#266) Upgrade Vue package dependencies * #267 Error in description of one of methods of Manifest interface * Upgrade Vue sample (#269) Upgrade Vue sample * Feature/356380: Update Angular * Upgrade jss-angular and jss-angular-schematics and jss-sample-app * Feature/356378 (#272) Upgrade CLI Packages Upgrade CLI Packages * Use Object.entries instead of Object.keys (#274) Use Object.entries instead of Object.keys * mediaApi.updateImageUrl loses revision querystring (#275) mediaApi.updateImageUrl loses revision querystring * DevTools loading hidden files and crashing (#276) * Feature/356373 (#273) Node Proxy: CURL URL -IL returns 500 OK Node Proxy: CURL URL -IL returns 500 OK * change logo (#279) change logo * upgrade react-native sample (#282) upgrade react-native sample * [React-Native] Extend Image component to render svg images (#283) * add react-native-svg to sample app * update react-native package-lock * add react-native-svg to sitecore-jss-react-native * #348713Explicitly state that field names are not affected by the serialization configuration on Layout Service (#284) * #348713 Explicitly state that field names are not affected by the serialization configuration on Layout Service * #348713 Update * Extended a CD server setup instructions (#286) * React native sample app (#291) React native sample app
Any idea when or if this will be released? |
@peterswallow This has been released since JSS 12.0.0, as well as a hook
|
@ambrauer I'm using 12.0.0 but |
@peterswallow How are you attempting to use? e.g. |
Hi there, I am using withSitecoreContext({ updatable: true }) in one of my UI components. The whole app is wrapped within a . However, when I navigate around the context seems not being updated...only when I refresh the page. Idea? |
Currently it's possible to get the Sitecore Context by using withSitecoreContext(): https://jss.sitecore.com/docs/client-frameworks/react/sample-app#sitecore-context-access
This works in most situations, but sometimes you don't want to wrap your component with this HOC. For example when you are creating a custom hook.
By exporting SitecoreContextReactContext you can use the new useContext hook: https://reactjs.org/docs/hooks-reference.html#usecontext
Then the following should work:
The text was updated successfully, but these errors were encountered: