preact Questions

3

Solved

So when testing one of my reducers in a Preact(not much different to React while testing with JEST) based project, I got bumped into this issue: Following output comes up when running jest test - ...
Postmillennialism asked 4/6, 2018 at 8:43

2

Solved

I am developing a Vite-React webapp to be used by me only, and heres my simple build command in package.json: "build": "vite build --emptyOutDir --base=./". It uses the Google F...
Lani asked 25/9, 2023 at 14:38

3

Solved

I was recently playing with new Fresh framework for deno and it was all great but at some point I realized that there is no possibility to add any additional meta data to page head tag. Basically I...
Enow asked 6/7, 2022 at 21:13

6

Solved

I am trying to run the preact create command using Yarn. It's simple to run preact create ..... ..... or npx preact create ... ..... It works fine and both of the commands use npm. But I am trying ...
Grison asked 5/3, 2021 at 16:29

1

I'm struggling with the correct types to use for event objects with Preact when not using preact/compat. It's fine with inline event handlers because they get their types from the props you're usin...
Diamine asked 17/3, 2023 at 12:20

2

Solved

I am experiencing this build error since last two days (Angular App). Error: node_modules/preact/src/jsx.d.ts:2138:24 - error TS2304: Cannot find name 'SVGMPathElement'. 2138 mpath: SVGAttributes&l...
Neldanelia asked 28/2, 2023 at 11:13

1

I moved my Next.js to use Preact, but as side-effect Storybook not working more as spected. The output log below, and at the end the commands to reproduce the issue: yarn build-storybook yarn run v...
Statistician asked 15/2, 2022 at 17:23

2

Preact Markup is 8.5kb, which is half the size of Preact. Is there a way to render raw HTML without having to parse it? One way I can think of is to render a placeholder and then replace the place...
X asked 30/7, 2019 at 5:29

0

I am using Parcel to bundle my Javascript files. Everything works fine when using the localhost server to test out the build, however in production it doesn't like dynamic imports. Here is the code...
Locket asked 8/7, 2022 at 17:20

2

Using Preact CLI is it possible to set the path where the app will be hosted outside of the root directory? For instance hosting the app at http://mywebsite.com/relativepath/index.html
Weak asked 17/8, 2017 at 18:56

2

As per Preact documentation, to convert a React app to Preact you have to alias webpack: { "resolve": { "alias": { "react": "preact-compat", "react-dom": "preact-compat" } } } How can you ...
Stewart asked 25/9, 2019 at 15:35

1

I'm trying to build a simple Todo App using Preact + Vite + Typescript + Redux. But I am facing some compatibility issues with redux and typescript. This is the error I'm getting. Uncaught TypeErro...
Faithless asked 11/9, 2021 at 7:7

2

Solved

I am looking to conditionally call useContext. This is my original code, which runs correctly, but fails tslint. Component that calls useResourceScope - say Component1 import { useEffect } from 're...
Raimes asked 2/6, 2021 at 1:50

4

I'm using custom-elements aka web-components within Preact. The problem is that Typescript complains about elements not being defined in JSX.IntrinsicElements - in this case a check-box element: &...
Speedboat asked 3/4, 2020 at 15:39

2

Solved

Is it possible to type check a components children with TypeScript (v3.0.1) and Preact (v8.3.1)? In React there is a ReactElement<T> for that. Is there something similar in Preact? I have a ...
Experimentalism asked 12/8, 2018 at 8:3

1

Solved

Inspired by preact's "no build tools route", I recently created a project with no build or bundling process. Conceptually, it looks like this (pseudo code following). I have a dependency ...
Environ asked 16/7, 2020 at 12:13

2

Solved

I came across posts where people mention useEffect and even give some great examples, but I cannot find any real documentation. Also I grepped node_modules/preact dir and there is no mention of use...
Blackstone asked 12/6, 2019 at 6:22

1

Solved

I am writing a simple component with Preact that uses an onChange handler for an <input/> element: function Example(props: {}) { return <input onChange={(e) => { const { value } = e....
Derayne asked 29/8, 2019 at 13:26

2

Solved

When focused in the input box, hitting enter submits the form. On submit, an error causes an error to be inserted into the state which causes a rerender and creates a new element to show the error....
Ectosarc asked 8/9, 2019 at 15:3

3

Solved

Trying to set up Jest to test my React components (Technically I'm using Preact) but same idea... Anytime I try to get a coverage report, I get errors when it hits any jsx syntax. Error Running ...
Dermal asked 9/7, 2019 at 12:35

1

Solved

React 16 triggers componentDidMount() when going back in Safari, even tho the component never unmounted. How does react know when to mount? class Foo extends React.Component { state = { loading:...
Alonzoaloof asked 22/5, 2019 at 14:18

1

Solved

I try to use Preact for most of my projects but now I have a requirement to use a React component. I don't want this to require me to switch frameworks. Is there anything I can do to render the Rea...
Wenzel asked 8/5, 2019 at 15:7

1

Solved

Hello all i want to do is a simple conditional rendering which i have done in react before but i cant seem to do it in preact. export const InfoSection = (props: Props) => { return ( <d...
Demonic asked 4/12, 2018 at 9:29

2

I'm currently building a Preact PWA with the CLI. My understanding was that wherever I have a component defined with JSX, I need to have import { h } from 'preact' at the top of the file. I remov...
Witting asked 20/9, 2018 at 3:44

3

Solved

Just getting started with Flow but can't seem to understand what it wants me to do with adding types for destructuring objects like i.e. props i.e. render({ count }, { displayHelp }) { Throws ...
Refine asked 10/4, 2017 at 16:19

© 2022 - 2024 — McMap. All rights reserved.