Comments (8)
Nevermind: fixed it
Problem with my setup
from hybrids.
Furthermore, I am interpreting a template literal as an HTML template using html``
in typescript.
Does this influence how data could be passed through?
from hybrids.
Hi @JiaJasonLiu! Welcome here. I strongly suggest to start with reading the official documentation. Each section has own Typescript page, with describes how to use it with TS.
Hybrids a long time ago had a property
export, but no more :)
from hybrids.
Yes, thank you.
(in typescript)
<simple-count count="hello"><simple-count>
I see that for instance for the simpleCounter type: when count is set as 0, it uses as 0.
However, if I set it as undefined, it goes back to "hello"
Is there a way to check if it is set beforehand
EDITED:
But weird, when I try with strings, it doesn't work
I just want to ASK:
Can I have to pass in the props?
Or do I have to use the store?
from hybrids.
Code example would be helpful, I am not sure what you mean.
Still, I encourage you to read docs carefully - there is a section, which describes how to define simple properties: https://hybrids.js.org/#/component-model/structure?id=primitives
What you can learn there, is that properties defined as primitives protects the type, so if you set count
to 'hello' it then is translated to a number: Number("hello")
.
from hybrids.
@JiaJasonLiu We will answer in more detail if you send an example of the problem you are trying to solve.
from hybrids.
@Qsppl I figured out some of the other stuff thank you.
One question: I am defining an object as a prop to pass into hybridjs component called session
sessionUser= { id: string lastLogin : number }
passing that into my table
<user-table session=${tableData}> </user-table>
interface Table {
session: sessionUser[] | string;
}
async function gettingThings(host: any): Promise<string> {
console.log('getting table', host.session)
...
}
export default define<Table>({
tag: 'user-table',
session: "undefined",
user: {
get: async host => await gettingThings(host),
},
render: ({ session}) =>
html`<p>what is ${session}</p> `,
what I get in the logs are getting table [object Object] (which is just a string)
and this
So, I can't use it.
What are the whys that I can get objects as a prop?
Thank you!
from hybrids.
Fine. Please ask in the future if other questions arise.
from hybrids.
Related Issues (20)
- Add a helper for assigning component properties HOT 3
- Dynamic columns not showing when render a html table HOT 4
- Add support for "TypeScript v5" HOT 3
- I can't create an arbitrary number of nested forms: HOT 6
- Small Type Inferencing Issue with Property<E, V> HOT 6
- Cannot pass an object to the API via the "list" method HOT 7
- version 8.2.17 backwards compatibility is broken! HOT 9
- Expand the functionality of drafts
- sync() with nested models is broken HOT 4
- Allow storing an object in a component property HOT 4
- Add partial loading of model data HOT 3
- Why do you remove the lastValue? HOT 2
- The store logs a lot of errors HOT 4
- Convert a Whole Component to Web Component HOT 8
- Scoped CSS HOT 6
- lagging update glitch HOT 2
- Component properties cannot be setted until they are observed HOT 2
- `store.set()` is very slow HOT 5
- Store loads items data when iterating the list of items HOT 2
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 hybrids.