Comments (9)
Wow facepalm hahah, this worked like a charm! thanks a lot β€οΈ
from fable-react.
I'm going to add some notes.
from fable-react.
done
from fable-react.
It's funny that you asked that, because in Fable 1.x you can use a .
to select a member when importing a value, like:
ofImport "Select.Creatable" "react-select" myOptions []
...but exactly right now I just removed it from Fable 2 because I thought nobody was using it π Can you give it a try and check if it works for you? If it does, I guess I should put it back in dev2.0 π
from fable-react.
I tried just now it but it didn't work with my example and I am not sure why. I have this function:
let creatable (props: ICreatableProps list) =
ofImport "Select.Creatable"
"react-select"
(keyValueList CaseRules.LowerFirst props)
[]
I get runtime error: Cannot read property Creatable of undefined
and also a compile warning export 'Select' was not found in 'react-select'
which is weird because I have installed react-select
correctly. Now even if I change Select.Creatable
to Select
I get the same warning . . . strange.
Anyways, if you are thinking of removing this pattern completely, their should be alternative way to do it because major UI frameworks (Elemental/Material/Semantic...) use this nesting to group elements.
I guess the reason no one is using this feature is because no one has tried yet to port these large frameworks.
from fable-react.
This is the usual confusion with JS imports π According to react-select README, it must be imported as follows:
import Select from 'react-select';
This is a default import (not a member import like import { Select } from 'react-select'
). For this, in Fable you just have to write "default"
. Can you try the following?
let creatable (props: ICreatableProps list) =
ofImport "default.Creatable" "react-select"
(keyValueList CaseRules.LowerFirst props)
[]
from fable-react.
Don't worry, I've made the same mistake thousands of times. Unfortunately, it's not something Fable can check at compile time :/ We need to make it more prominent in the docs.
Thanks for confirming it's working! I'll put back the feature in Fable 2 π
from fable-react.
@alfonsogarciacaro would it be worth to note this somewhere on this repository? Aka a FAQ ;)
from fable-react.
@realvictorprm You're right. This feature is not documented, we should add it in the doc section talking about imports π
from fable-react.
Related Issues (20)
- How to instantiate a custom React Component in Fable? HOT 2
- module.hot.addStatusHandler is not a function HOT 8
- React Server Components integration HOT 2
- Can't figure out how to wrap my view with a Higher Order Component HOT 4
- JsInterop helper for wrapping a higher order component HOT 2
- Can't reference React in Fable HOT 2
- Fable.ReactServer.cssProp very slow HOT 4
- Add Custom DU to DOMAttr HOT 1
- FunctionComponent.Lazy and SSR HOT 1
- Update samples to Fable 3
- ReactDOM.hydrate is no longer supported in React 18 HOT 17
- Can't update shared state passed with useContext? HOT 3
- Q: Use ReactElement import member for Storybook HOT 3
- Missing 'open' from Fable.React.Props? HOT 2
- Last Fable.React upgrade breaks my code HOT 7
- Publish source files from Fable.React.Types and Fable.ReactDom.Types to nuget HOT 5
- Fable.React version 8 depends on React.Dom gte 18 lt 19 according to femto
- Add Pointer Events HOT 3
- Why is useCallback not implemented? HOT 3
- How to obtain a component ref in a function component? HOT 5
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 fable-react.