Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace react with preact #1224

Closed
proddy opened this issue Jul 12, 2023 · 0 comments
Closed

replace react with preact #1224

proddy opened this issue Jul 12, 2023 · 0 comments
Labels
technical Technical enhancement, or tech-debt issue
Milestone

Comments

@proddy
Copy link
Contributor

proddy commented Jul 12, 2023

Inspired by rjwats/esp8266-react#327 I thought I'd have another go at trying out preact. preact is a lightweight version of react, with a much smaller bundle size and ideal for slow connections where loading speed could be a problem. There are drawbacks obviously (see https://www.merixstudio.com/blog/what-preact-and-when-should-you-consider-using-it) but for our project, I think it's safe and worth experimenting with.

Using the compatibility mode (preact/compat) and the vite plugin preact/preset-vite I only needed to replace react() with preact() in the vite.config.ts.

It saves 36KB in Flash so now we're able to use the espressif IDF4.4.4/pio 6.3.2 library on an 2MB ESP32. Pretty impressive for changing one line.

Thanks @rjjrbatarao :-)

@proddy proddy added the technical Technical enhancement, or tech-debt issue label Jul 12, 2023
@proddy proddy added this to the v3.6.0 milestone Jul 12, 2023
proddy added a commit to proddy/EMS-ESP32 that referenced this issue Jul 12, 2023
proddy added a commit that referenced this issue Jul 13, 2023
replace react with preact #1224
@proddy proddy closed this as completed Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical Technical enhancement, or tech-debt issue
Projects
None yet
Development

No branches or pull requests

1 participant