fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
275 stars 66 forks source link

Forgetting some statement, but what? #156

Closed srlopez closed 5 years ago

srlopez commented 5 years ago

Hi from Spain Alfonso, I am trying to reproduce the excellent presentation from Tomasz Heimowski about SAFE in the eXchange of 2018. His code is in https://github.com/theimowski/safe-demo-fsharp-exchange-18. But I try to rewrite in a container (https://cloud.docker.com/repository/docker/srlopez/safe/) My starting point is: dotnet new SAFE --layout fulma-landing --communication remoting As you can see i planning do Remoting with Saturn.

But I find, at the very beginning, that when entering the image in Client.fs, this code: Image.image [Image.Is128x128] [img [Src imgSrc]] works perfectly, but simply add a Style Image.image [Image.Is128x128] [img [Src imgSrc Style [Border "1px solid"]]] Give the following error

ERROR in ./src/Client/Client.fs
Module Error (from ./node_modules/fable-loader/index.js):
/app/src/Client/Client.fs(178,38): (178,48) 
error FSHARP: This value is not a function and cannot be applied ...

Going forward, without Style ;).

I'm forgetting something, but I do not know what or how to fix it so I can continue. The message of fable-loader, indicate to me that it is a problem of Fable, and not of SAFE.

Thanks in advance. Mil gracias por tu trabajo. Excelente!

MangelMaxime commented 5 years ago

Hello @srlopez ,

the compiler is telling you that Src imgSrc Style is not a function and cannot be applied.

The code

Image.image [Image.Is128x128] [img [Src imgSrc Style [Border "1px solid"]]]

should be written like that (please note the ;):

Image.image [Image.Is128x128] [img [Src imgSrc; Style [Border "1px solid"]]]

or in a more visual way

Image.image [Image.Is128x128] 
    [ img [ Src imgSrc 
            Style [ Border "1px solid" ] ] ]

In F#, values in a list are separated by a new line or ;.

srlopez commented 5 years ago

Thak you very much! Newbie issues!

MangelMaxime commented 5 years ago

Happy to help :)

I am closing this issue and in theory you can close the issue you created in the SAFE demo repo :)