liqula / react-hs

A GHCJS binding to React based on the Flux design. The flux design pushes state and complicated logic out of the view, allowing the rendering functions and event handlers to be pure Haskell functions.
32 stars 10 forks source link

Error when using img_ tag #72

Closed tysonzero closed 6 years ago

tysonzero commented 7 years ago
uncaught exception in Haskell main thread: Invariant Violation: img is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`. Check the render method of null.

I cannot use img_ at all currently, here is a minimal failing example:

{-# LANGUAGE DataKinds, OverloadedStrings #-}

module Main (main) where

import React.Flux (View, img_, mkView, reactRenderView)

main :: IO ()
main = reactRenderView "content" baseView

baseView :: View '[]
baseView = mkView "" $ img_ [] ""
tysonzero commented 7 years ago

It seems like we need two separate primitives for defining elements, term' as we have been using so far for elements that can have children, and term'_ for elements like img_ that cannot. Would also avoid the annoying empty string at the end of img_.

fisx commented 7 years ago

Thanks for reporting this.

Related to #65.

I still can't promise anything, but I hope I'll have more time for open issues and PRs this week.

tysonzero commented 7 years ago

Alright thank you!

Are you planning on adding any new core developers anytime soon, it seems like you are generally quite busy.

fisx commented 7 years ago

related: https://hackage.haskell.org/package/type-of-html

this is an approach to bring correct html and type-correct html closer together. i would love to have time to try and work this into React.Flux.DOM.

fisx commented 6 years ago

has this been fixed in #65?

tysonzero commented 6 years ago

@fisx Yes it has