Closed anmonteiro closed 1 year ago
I would like to rethink this and keep the toplevel equal to the library names:
"react"
-> React.re
"react-dom"
-> ReactDOM.re
"react-dom/test-utils"
-> ReactDOM.TestUtils (current library is called "reason-react.test" and expose Renderer and Utils"react-test-renderer"
-> "ReactTestRenderer.re""react-dom/server"
-> ReactDOM.Server"ReasonReactRouter"
(or SimpleRouter) currently called React.Router
(This isn't related with the toplevel, but rather showcase that isn't part of React)We could unwrap and keep the minimum toplevels but those match the packages installed from npm 1 to 1.
The benefits of this are:
ReactNative
, and not React.Native
I don't think that's a good idea. Why is it so important that our library structure matches the JS package names / sub-paths?
I actually think that the current wrapped design is quite elegant and there's a nice sub-module for everything that you can access.
I don't think that's a good idea. Why is it so important that our library structure matches the JS package names / sub-paths?
First for discoverability and second to have the minimum amount of subjectivity on the names of the structure. People don't read the documentation to use a module/function, they often use autocomplete.
I don't think it's very discoverable having to add (libraries react react.dom react.dom-server)
in order to have those modules appear in your editor. It's a much better API to have (libraries reason-react)
and React.DOM
etc. don't you think?
What I'm proposing is to have libraries reason-react
which exposes react, reactdom, etc. and not fall into the trap what we had before so, React.Event
, ReactDOM.Style
, ReactDOM.Server
etc still remains wrapped.
how do you expose those multiple toplevel modules from:
reason-react
wrapped false
, one module per toplevel, the rest either inlined or private libraries
That actually sounds pretty nice if you can make it work. I'm in favor of it, if we can manage to hide the internal modules.
reason-react exposes too many toplevel modules. These could be nested under
React
, e.g.:React.DOM
React.ErrorBoundary
React.DOMServer
etc