#react

posts tagged #react

0

A React-like JS Framework with Web Components

preview

IMPORTANT DISCLAIMER: This is my own project. Im am using AI, so lets get that out of the way… because its the key reason for why YOU SHOULD NOT USE IT. Im not trying to promote “yet another ui framework”, this is an investigation to see what is possible. Its unreviewed, unaudited and far from finished. Nobody else should be using this. This framework is intended for myself on my own projects. It is provided open-source for transparency, testing and demo purposes. Feel free to reach out for clarity if you have any questions.

Im was investigating an idea i had about JSX-like syntax for webcomponents after some experience with Lit. I am sharing this here because it might be interesting/educational.

Lit is a nice lightweight UI framework, but i didnt like that it was using class-based components. It can support React with a wrapper, buts React is fundamentally an abstraction away from the DOM.

Vue has a nice approach but i prefer working with the syntax that React uses. I find it more intuitive for debugging and deterministic rendering. I wondered if with webcomponents, i could create a UI framework that didnt need to be transpiled.

My intentions with this framework is to get to a reasonable level of stability, to then replace React on some of my existing projects. I made a start by creating some basic reusable ui components components to be built with the js framework. Aiming for something like Material UI.

I can then simmer that slop into some basic UI demos:

To better demonstrate the pure javascript approach, i created an example of using a minimal amount of tooling for a PWA. The aim here is to keep the application logic in readable js and abstract the framework logic away from the developer for better DX.

To simplify things for myself, i added something similar to module-federation where i can fetch the dim dependencies from remote instead of publishing to npm. The approach has tradoffs worth considering and is still a work in progress.

The disclaimer above is always worth repeating. Im aiming for a post like this to be like “building in public”. If interesting to anyone, i hope its inviting to take a look. It’s hard to determine if / when its a good time to share, so best to get it out there sooner for any outstanding issues i may have overlooked.

IMPORTANT DISCLAIMER: This is my own project. Im am using AI, so lets get that out of the way… because its the key reason for why YOU SHOULD NOT USE IT. Im not trying to promote “yet another ui framework”, this is an investigation to see what is possible. Its unreviewed, unaudited and far from finished. Nobody else should be using this. This framework is intended for myself on my own projects. It is provided open-source for transparency, testing and demo purposes. Feel free to reach out for clarity if you have any questions.

Im was investigating an idea i had about JSX-like syntax for webcomponents after some experience with Lit. I am sharing this here because it might be interesting/educational.

Lit is a nice lightweight UI framework, but i didnt like that it was using class-based components. It can support React with a wrapper, buts React is fundamentally an abstraction away from the DOM.

Vue has a nice approach but i prefer working with the syntax that React uses. I find it more intuitive for debugging and deterministic rendering. I wondered if with webcomponents, i could create a UI framework that didnt need to be transpiled.

My intentions with this framework is to get to a reasonable level of stability, to then replace React on some of my existing projects. I made a start by creating some basic reusable ui components components to be built with the js framework. Aiming for something like Material UI.

I can then simmer that slop into some basic UI demos:

To better demonstrate the pure javascript approach, i created an example of using a minimal amount of tooling for a PWA. The aim here is to keep the application logic in readable js and abstract the framework logic away from the developer for better DX.

To simplify things for myself, i added something similar to module-federation where i can fetch the dim dependencies from remote instead of publishing to npm. The approach has tradoffs worth considering and is still a work in progress.

The disclaimer above is always worth repeating. Im aiming for a post like this to be like “building in public”. If interesting to anyone, i hope its inviting to take a look. It’s hard to determine if / when its a good time to share, so best to get it out there sooner for any outstanding issues i may have overlooked.

0

A React Hook For Asynchronous State Management.

positive-intentions 8. Encrypted Storage & Loading States | positive-intentions positive-intentions.com
preview

A fairly unique approach to state management using encrypted asynchronous state updates.

It is not production-ready. I’m working on it to use in my own projects. It isn’t reviewed or audited by a third-party, so I can’t recommend you use it in your own code. Sharing for testing and demo purposes only.

TLDR; The title of this post.

Feel free to reach out for clarity instead of reading the code/docs.

I was working on “react-like syntax for webcomponents”. I started off with an approach for asynchronous state management so that components outside the shadow-root could receive updates. (The events are also encrypted to secure against things like browser extensions.)

positive-intentions.com/…/async-state-management

It then made sense to be able to persist that data so it can work between page releoads.

positive-intentions.com/docs/…/bottom-up-storage

The result looks and works like the following when used in a project.

positive-intentions.com/docs/…/encrypted-store

The Dim framework seems like a dead-end. I wanted to try the hook out on my existing React projects. So I created the equivalent React hook.

positive-intentions.com/…/use-dim-store-react

I find it to be performant and I want to push the scale of the approach, so I am in the process of testing it out on my projects. A notable use-case there is storing encrypted files at rest.

Feel free to reach out for clarity.

A fairly unique approach to state management using encrypted asynchronous state updates.

It is not production-ready. I’m working on it to use in my own projects. It isn’t reviewed or audited by a third-party, so I can’t recommend you use it in your own code. Sharing for testing and demo purposes only.

TLDR; The title of this post.

Feel free to reach out for clarity instead of reading the code/docs.

I was working on “react-like syntax for webcomponents”. I started off with an approach for asynchronous state management so that components outside the shadow-root could receive updates. (The events are also encrypted to secure against things like browser extensions.)

positive-intentions.com/…/async-state-management

It then made sense to be able to persist that data so it can work between page releoads.

positive-intentions.com/docs/…/bottom-up-storage

The result looks and works like the following when used in a project.

positive-intentions.com/docs/…/encrypted-store

The Dim framework seems like a dead-end. I wanted to try the hook out on my existing React projects. So I created the equivalent React hook.

positive-intentions.com/…/use-dim-store-react

I find it to be performant and I want to push the scale of the approach, so I am in the process of testing it out on my projects. A notable use-case there is storing encrypted files at rest.

Feel free to reach out for clarity.

0

help needed to normalize initial state

preview

I’m learning React and working on my first course project, a CV generator app. I created an initial state - snippet below - which I normalized to an extent. The professional experience field has an Employer + the employer related data (employment dates, position etc.).

I’m encountering two problems with the current structure:

  • the Achievements section of each employer, which has a few subpoints, is in the same place as the company data. I can programatically select only the needed fields to display, but I was wandering if there is a better structure that I’m missing
  • when I add a second, third… employer, all their company data goes in the same place. Again, I can retrieve only what I need based on id, but I was wondering if there is a semantically better choice
const initialPerson = {
  employers: {
    byIds: {
      "employer-1": {
        id: "employer-1",
        name: "Company",
        value: "Test Org 1",
        cdataIds: ["cdata-1", "cdata-2", "cdata-3", "cdata-4", "cdata-5", "cdata-6"],
      },
      // other employers follow 
    },
    allIds: ["employer-1"],
  },
  companyData: {
    byIds: {
      "cdata-1": {
        id: "experience-1",
        name: "Position",
        value: "Test Engineer 1",
      },
      "cdata-2": {
        id: "exp-2",
        name: "Duration",
        value: "Jan. 2025 - Present",
      },
      "cdata-3": {
        id: "exp-3",
        name: "Location",
        value: "Brussels, Belgium",
      },
      "cdata-4": {
        id: "exp-4",
        name: "Achievement",
        value: "STAR: Situation Task Action Result"
      },
      "cdata-5": {
        id: "exp-5",
        name: "Achievement",
        value: "XYZ: Accomplished X as measured by Y by doing Z",
      },
      "cdata-6": {
        id: "exp-6",
        name: "Achievement",
        value: "CAR: Challenge Action Result",
      },
    },
    // data from all employers goes here
    allIds: ["cdata-1", "cdata-2", "cdata-3", "cdata-4", "excdatap-5", "cdata-6"],
  },
}

I’m learning React and working on my first course project, a CV generator app. I created an initial state - snippet below - which I normalized to an extent. The professional experience field has an Employer + the employer related data (employment dates, position etc.).

I’m encountering two problems with the current structure:

  • the Achievements section of each employer, which has a few subpoints, is in the same place as the company data. I can programatically select only the needed fields to display, but I was wandering if there is a better structure that I’m missing
  • when I add a second, third… employer, all their company data goes in the same place. Again, I can retrieve only what I need based on id, but I was wondering if there is a semantically better choice
const initialPerson = {
  employers: {
    byIds: {
      "employer-1": {
        id: "employer-1",
        name: "Company",
        value: "Test Org 1",
        cdataIds: ["cdata-1", "cdata-2", "cdata-3", "cdata-4", "cdata-5", "cdata-6"],
      },
      // other employers follow 
    },
    allIds: ["employer-1"],
  },
  companyData: {
    byIds: {
      "cdata-1": {
        id: "experience-1",
        name: "Position",
        value: "Test Engineer 1",
      },
      "cdata-2": {
        id: "exp-2",
        name: "Duration",
        value: "Jan. 2025 - Present",
      },
      "cdata-3": {
        id: "exp-3",
        name: "Location",
        value: "Brussels, Belgium",
      },
      "cdata-4": {
        id: "exp-4",
        name: "Achievement",
        value: "STAR: Situation Task Action Result"
      },
      "cdata-5": {
        id: "exp-5",
        name: "Achievement",
        value: "XYZ: Accomplished X as measured by Y by doing Z",
      },
      "cdata-6": {
        id: "exp-6",
        name: "Achievement",
        value: "CAR: Challenge Action Result",
      },
    },
    // data from all employers goes here
    allIds: ["cdata-1", "cdata-2", "cdata-3", "cdata-4", "excdatap-5", "cdata-6"],
  },
}
0

Our @nickschot shares how to integrate and @emberjs on our blog, based on learnings from a number of multi-framework projects our team did recently. If you’re looking to mix frameworks and face

preview

Our @nickschot shares how to integrate @react and @emberjs on our blog, based on learnings from a number of multi-framework projects our team did recently. If you’re looking to mix frameworks and face challenges, reach out.

➡️ https://mainmatter.com/blog/2025/12/12/react-ember/

#react #emberjs

Our @nickschot shares how to integrate @react and @emberjs on our blog, based on learnings from a number of multi-framework projects our team did recently. If you’re looking to mix frameworks and face challenges, reach out.

➡️ https://mainmatter.com/blog/2025/12/12/react-ember/

#react #emberjs

0

Excited to share this and @djangocms integration tutorial—a clear, concise walkthrough demonstrating how to marry a dynamic modern frontend (React) with a powerful backend CMS (Django CMS).

preview

Excited to share this @react and @djangocms integration tutorial—a clear, concise walkthrough demonstrating how to marry a dynamic modern frontend (React) with a powerful backend CMS (Django CMS). Whether you’re a frontend engineer looking to enhance content management, or a backend developer eager to elevate user interfaces, this tutorial delivers seamless integration strategies every step of the way.

📺 Check it out

https://www.youtube.com/watch?v=qTQKf1KvXmU

Excited to share this @react and @djangocms integration tutorial—a clear, concise walkthrough demonstrating how to marry a dynamic modern frontend (React) with a powerful backend CMS (Django CMS). Whether you’re a frontend engineer looking to enhance content management, or a backend developer eager to elevate user interfaces, this tutorial delivers seamless integration strategies every step of the way.

📺 Check it out

https://www.youtube.com/watch?v=qTQKf1KvXmU

0

Count child elements HOC

preview

I’m looking to write an HOC that counts and prints to the console the number of <h1/> elements in the wrapped component. For example:

const Foo: FC<{}> = ({}) => {
    return (
        <div>
            <h1>Foo</h1>
            <p>Bar</p>
        </div>
    )
}


export default countH1(Foo)

this should print 1 and then return Foo as is for rendering.

React.Children.forEach(child => {...})

seems to be about the explicit children property and not descendant html elements. How can I achieve this?

I’m looking to write an HOC that counts and prints to the console the number of <h1/> elements in the wrapped component. For example:

const Foo: FC<{}> = ({}) => {
    return (
        <div>
            <h1>Foo</h1>
            <p>Bar</p>
        </div>
    )
}


export default countH1(Foo)

this should print 1 and then return Foo as is for rendering.

React.Children.forEach(child => {...})

seems to be about the explicit children property and not descendant html elements. How can I achieve this?