Comments (3)
Does this resolve your issue? https://github.com/remarkablemark/html-react-parser/tree/v5.1.10#v5
from html-react-parser.
Technically yes, I'm doing it a bit more "safely" than that:
function getChildNodes(childNodes: ChildNode[]): DOMNode[] {
// Hacky but we need to only get named nodes (e.g. not comment nodes), and need to coerce them to be DOMNodes.
return childNodes
.filter(o => o instanceof Comment || o instanceof Element || o instanceof ProcessingInstruction || o instanceof Text)
.map(o => o as DOMNode);
}
Called as:
domToReact(getChildNodes(node.children))
Coercing the type to DOMNode[]
just hides the underlying type issue.
from html-react-parser.
Gotcha can you provide a reproducible example?
from html-react-parser.
Related Issues (20)
- Importing the lib with a very large size HOT 2
- How to resize/style the HTML content? HOT 11
- important style is not parsed HOT 13
- Resolution error when using TypeScript with `moduleResolution` set to `node16` or `nodenext` HOT 5
- How to keep a specific element from being transformed by React? HOT 2
- Type of `parse` is `any` HOT 2
- Version 5.1.5 - multiple versions of @types/react causes typescript build errors HOT 6
- Incompatible default exports between ESM and CJS HOT 5
- domNode to HTML string? HOT 2
- Usage in web worker HOT 9
- String text with less than greater than sign are treated as tags. (eg. 4<y<8) HOT 1
- Components outside html component get resized HOT 13
- Next JS Support HOT 7
- Question: Replace node type text by a React Component HOT 2
- Sibling self closing tags become nested HOT 4
- React 19 RC Error HOT 3
- Nested list not rendering HOT 4
- Parser is breaking when we are provinding some content <content> HOT 1
- Allow React 19 as a peer dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-react-parser.