Comments (11)
@Simply007, I noticed you're doing the same thing with the models as I did when I was trying out the TS SDK. For example, in order to make the names translate from body_copy
to bodyCopy
. I ended up writing a helper method to blanket map these items instead of having to map them individually. See https://gist.github.com/ChristopherJennings/3086c7225f6b391ecca9feb6bf3affc4 for my implementation. I then used this in the propertyResolver. This is likely something that should just get included in the TS SDK though.
from sample-app-react.
New branch created:
https://github.com/Kentico/cloud-sample-app-js/tree/migrate_to_typescript_sdk
from sample-app-react.
- models created
- delivery client encapsulation created
TODO:
Use client in the sores and rewrite components to use new models
from sample-app-react.
This could be mentioned somewhere in the readme of the TS SDK.
from sample-app-react.
It kind of is: https://github.com/Enngage/KenticoCloudDeliveryTypeScriptSDK#property-binding-in-models
That example notes that the names are all lower case, which is true, but the example also assumes that the code name doesn't include spaces, which typically are there and could be converted using this method.
from sample-app-react.
This has been added as an issue on the SDK repo: kontent-ai/delivery-sdk-js#6
from sample-app-react.
I believe that @Simply007 used the generator to generate models which included the bindings that automatically convert '_' into camelcase format and no extra effort was required for this (correct me if I'm wrong).
from sample-app-react.
@Enngage, you're probably right. I guess we'll just have to see what @Simply007 has to say.
from sample-app-react.
Yeap I have used generator and then converted typescript models to javascript syntax.
Since we agreed to use typescript, I will regenerate models without any modification and it will be sufficient.
It would be great thet mapping would be done automatically and used @ChristopherJennings modifier, but for now I will use generated code.
Thanks for tips :-)
from sample-app-react.
@Simply007 , the code generator should already do, what Chris mentioned automatically. What you might however do manually is to use proper models instead of 'IContentItem' for modular item properties as Cloud does not provide this link.
from sample-app-react.
New pull request cretated:
from sample-app-react.
Related Issues (20)
- Replace hardcoded sample project items count in SelectedProject.js HOT 3
- Extract API keys definition to .env HOT 2
- Fix Glitch setup HOT 3
- Update integration sample - Bynder HOT 4
- Update integration sample - Shopify HOT 2
- Update integration sample - GA experiments HOT 5
- Update integration sample - Google analytics HOT 2
- Update integration sample - Hubspot HOT 4
- Update integration sample - Magento HOT 11
- Update integration sample - Optimizely HOT 2
- Image Sliders don't Work in the React Sample App HOT 1
- Configuration admin page is not up-to-date with the latest design HOT 3
- Update to latest React HOT 5
- Store rewrite
- Upgrade to npm lockfile v2
- google-maps-react is not supported in React 17 HOT 1
- [Spike] Prepare multilingual setup HOT 3
- Missing typescript in dev dependencies
- Cannot leave configuration in web spotlight
- Put the kontent client into a react context
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sample-app-react.