News for hackers. Stuff that matters.
Re:Show HN: Zero cost abstractions in web development by fctorial on Wednesday March 17, 2021 @06:23PM (#26497523)
Hi all. constexpr.js is feature complete at this point. i.e. It can be used to build any kind of website. The last feature added is generator pages:

https://fctorial.github.io/posts/constexprjs_generator_pages...

Let me know if there are any features that you think are missing.

Re:Show HN: Zero cost abstractions in web development by vitriolum on Wednesday March 17, 2021 @06:47PM (#26497746)
That's very interesting. I have pretty much all my components in React. How can you use React / jsx with constexpr?
Re:Show HN: Zero cost abstractions in web development by fctorial on Wednesday March 17, 2021 @07:06PM (#26497918)
For react, you can use the `useEffect` hook to trigger compilation after the component renders:

    useEffect(() =>
      window._ConstexprJS_.compile()
    , [])
There's a babel jsx loader, that could be used. However, it dynamically compiles jsx to js and adds a script tag containing raw javascript to the DOM. You'll have to manually mark these new tags as 'constexpr', which shouldn't be too difficult.

Or you could compile jsx with webpack and then use it. With constexpr.js, the final static page will look exactly like the original dynamic page, so using the webpack output should be easy. I might add an example in the next week.

Re:Show HN: Zero cost abstractions in web development by vitriolum on Thursday March 18, 2021 @03:54AM (#26500469)
Thanks! I guess an example would be really cool, give the amount of FE devs who already use React.