Giter Club home page Giter Club logo

Comments (8)

JiaJasonLiu avatar JiaJasonLiu commented on September 26, 2024 1

Nevermind: fixed it

Problem with my setup

from hybrids.

JiaJasonLiu avatar JiaJasonLiu commented on September 26, 2024

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.

smalluban avatar smalluban commented on September 26, 2024

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.

https://hybrids.js.org

Hybrids a long time ago had a property export, but no more :)

from hybrids.

JiaJasonLiu avatar JiaJasonLiu commented on September 26, 2024

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.

smalluban avatar smalluban commented on September 26, 2024

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.

Qsppl avatar Qsppl commented on September 26, 2024

@JiaJasonLiu We will answer in more detail if you send an example of the problem you are trying to solve.

from hybrids.

JiaJasonLiu avatar JiaJasonLiu commented on September 26, 2024

@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
Screenshot 2024-03-25 at 12 46 09
So, I can't use it.

What are the whys that I can get objects as a prop?

Thank you!

from hybrids.

Qsppl avatar Qsppl commented on September 26, 2024

Fine. Please ask in the future if other questions arise.

from hybrids.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.