dodothedev :arch_linux::emacs: · @dodothedev
105 followers · 1608 posts · Server hachyderm.io

Day 2 of learning with and I'm liking it. Today, he's telling me all about . Interesting concept.



#react #bobziroll #jsx #scrimba #webdevelopment #frontend #CodeNewbie

Last updated 1 year ago

Doug Parker · @develwithoutacause
236 followers · 940 posts · Server techhub.social

Playing a bit with / today and am feeling the pain of not having host elements. I've realized that because a "component" is really just a template, there is no implicit contract around what it actually rendered.

As an arbitrary example, what if I want to set a style on a `<Foo />` component? What selector should I use for that style? I have no idea what `<Foo />` will actually generate, or even how many top-level elements it will output. The `Foo` component _must_ expose some kind of `className` or other API to provide this behavior, it's not implicit at all.

Maybe this is good because it provides stronger encapsulation. But it can also lead to bugs. If I render `<Header />` a `header` CSS selector is _probably_ right. But what if `<Header />` actually renders:

<div>
<header>...</header>
</div>

Then a `header` selector isn't actually the top-level element and my style could easily be wrong.

Just some idle thoughts about the lack of host elements.

#preact #jsx #vdom

Last updated 1 year ago

Reading ‘Why Tailwind CSS Won’ and was caught off-guard by this comment from Matt Rickard “few developers are writing HTML (instead, they are writing JSX or TSX).” What do you write mostly?

#tailwind #html #jsx #tsx

Last updated 1 year ago

The Spicy Web · @vanilla
548 followers · 344 posts · Server social.spicyweb.dev

Chris Coyier @chriscoyier presents some examples of using without React and talks about other flavors of JSX like @astro and even SSR:

thathtml.blog/2023/08/vanilla-

#jsx #preact #webdev #html

Last updated 1 year ago

Emilis 🇺🇦 · @emilis
109 followers · 989 posts · Server fosstodon.org

A good overview of changes discussed at and related to :

eisenbergeffect.medium.com/the

We may even get native in !

I hope they get a better syntax for templates this time. IMHO directives or custom mini-languages introduce unnecessary complexity with [often] limited capabilities. Embedded JS should be used one way () or another.

#w3c #tc39 #webcomponents #signals #javascript #jsx

Last updated 1 year ago

Frank Quednau · @flq
81 followers · 919 posts · Server freiburg.social

Sadly, has no switch expressions, but at least when working with in you can use "useMemo" to "fake" it.

#javascript #jsx #react

Last updated 1 year ago

Sal Rahman · @manlycoffee
70 followers · 976 posts · Server techhub.social

Why don't some people like CSS-in-JS?

Is it because code written in CSS-in-JS don't allow you to take advantage of the "cascading" nature of CSS?

Is it because you can't take advantage of selectors?

Is it because there might be some compilation steps required when employing CSS-in-JS? And if compilation isn't used, there might be some render-time slowdown?

?

#css #javascript #jsx #react #solidjs #preact #cssinjs #webdevelopment

Last updated 1 year ago

Happy Coding Bot · @HappyCodingBot
1 followers · 164 posts · Server botsin.space
StephOne · @sirber
269 followers · 2685 posts · Server fosstodon.org

, , and useState is pretty fun and clean! Much better than .

#react #jsx #typescript #vue3 #javascript #webdev

Last updated 1 year ago

Doug Parker · @develwithoutacause
219 followers · 790 posts · Server techhub.social

@davatron5000 @collinsworth This is an interesting read, though I wonder if this has less to do with compile steps and more to do with authoring format?

You talk about vendor lock-in for the compiler, but I feel the lock-in has more to do with the way you are authoring code. That anything inside a .vue or .svelte file is inherently coupled to those frameworks and is "more locked-in" than something like . That seems independent of whether or not a compiler is being run.

For example, how would you feel if or shipped your raw templates and interpreted them at runtime? Would that be less locked-in, even though you're writing the same code? What about if Lit *required* a compiler, but otherwise was authored the same way?

I personally always disliked frameworks that fork the language to achieve their ends (ex. framework-specific file extensions or ). I think you're describing a very similar emotional reaction I feel to those FWs, I wonder if it's the same?

#lit #vue #svelte #javascript #jsx

Last updated 1 year ago

Alex 🍜 · @mojoaxel
212 followers · 431 posts · Server social.tchncs.de

@emilis you're welcome! Try to find help! There is a way out of the and sect! You can do it! 😉

#jsx #react

Last updated 2 years ago

Alex 🍜 · @mojoaxel
212 followers · 431 posts · Server social.tchncs.de

@lea @codepen
....or, you could just use template strings like a normal, healthy developer that hates because it's an abomination 😉

#jsx #javascript

Last updated 2 years ago

Jan Andrle · @jaandrle
115 followers · 1467 posts · Server fosstodon.org

дэн on Twitter: "after the mess of early PHP code, much of the world has moved to “separating” view and controller. view templates in separate files, logic separately. but this is not what happened at FB. there, XHP fixed that. XHP is like JSX + React component model, but for PHP/Hack." / Twitter - twitter.com/dan_abramov/status

#webdev #php #xhp #jsx #react

Last updated 2 years ago

Komish · @komish
21 followers · 107 posts · Server hachyderm.io

@developit so I’ve got a mix of and going in this project so I can get a feel for the differences.

For whatever reason, I can’t get the document formatting in vscode to get this even remotely close to look like it’s properly indented. Also missing Emmett completions (not sure if I would have that with jsx yet) and tag autoclosing.

Can’t tell if I’m missing something or my lit-html extension is misconfigured.

Otherwise it’s going great!

#jsx #htm #preact #preactjs #js #webdev

Last updated 2 years ago

Doug Parker · @develwithoutacause
202 followers · 640 posts · Server techhub.social

: A well-known global type like `HTMLElementTagNameMap`, but for attribute definitions. This could be used in tools like to automatically type check their rendered output and make sure they are using correctly.

Gets tricky with attributes vs properties though. In client side rendered use cases, you want both. But in SSR use cases you only want attributes.

#idea #jsx #webcomponents

Last updated 2 years ago

Doug Parker · @develwithoutacause
201 followers · 632 posts · Server techhub.social

@developit Could the error handling be done in some kind of dev mode? I know and both have the concept of "dev mode" for additional validation.

Personally I like the strict approach, I just didn't realize was that strict (it's a new experience for me), and figuring that out took a solid 45 minutes of debugging which an error message would have cut down to 1.

#angular #lit #xml #jsx

Last updated 2 years ago

Doug Parker · @develwithoutacause
201 followers · 615 posts · Server techhub.social

Apparently (or / ) cannot directly render comments: github.com/preactjs/preact/iss

I get why that's not super useful in a client-side context, but particularly for server-side rendering use cases I would expect to be able to render comments. I would expect to be able to render any arbitrary DOM structure, but I guess that's not possible out of the box?

Not sure if there any workarounds to render comments in Preact. I'm not immediately able to find anything, might be a challenge to work around.

#preact #jsx #vdom

Last updated 2 years ago

Doug Parker · @develwithoutacause
201 followers · 614 posts · Server techhub.social

I just started playing around with with and the first thing I did was render the classic:

```
render(html`
<!DOCTYPE html>
<html>
<head>
<title>Preact</title>
<meta charset="utf8">
</head>
<body>
<h2>Hello, World!</h2>
</body>
</html>
`)
```

And this intuitively output:

```
html
<head>
<title>Preact</title>
<meta charset="utf8" >
<body>
<h2>Hello, World!</h2>
</body>
</head>
```

Lolwat?
* `<!DOCTYPE html>` is gone.
* `<html>` turned into `html` and lost its close tag.
* `<body>` got moved inside `<head>`.

Apparently you can't output a doctype at all (github.com/preactjs/preact-ren) and the `<meta>` tag is not self-closing in .

I'm willing to accept those constraints, but this is an utter failure of DX IMHO. If my template is wrong, TELL ME! Don't just generate what's effectively garbage for seemingly no reason. There's no obviously logical path from "bad output" to "the mistake in my code". Error messages, please!

#preact #ssr #htm #wtf #jsx

Last updated 2 years ago

Xe :verified: · @cadey
4032 followers · 4044 posts · Server pony.social
Rob Pegoraro · @robpegoraro
967 followers · 438 posts · Server journa.host

And why am I in Dallas on this spring-like morning? To try out the inflight WiFi on a regional jet--that carrier is hosting a media day at its DAL facility to show off the service. (JSX covered flights and lodging for me and other out-of-town journalists.)

#starlink #jsx

Last updated 2 years ago