with-reasonml example errors when using 6.0.0-canary.6
See original GitHub issueThis example works fine when using the stable version v5.1 but causes an error when upgrading to the latest canary. It looks like it might be related to the new Babel v7 beta or the babel-plugin-bucklescript
that is used but I couldn’t isolate/reproduce the problem in the other repo.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
The with-reasonml
example should work in v6 canary as it did under v5.x
Current Behavior
Steps to Reproduce (for bugs)
yarn create next-app --example with-reasonml with-reasonml-app
cd with-reasonml-app
yarn && yarn dev
- Navigate to
localhost:3000
It works! - Bump version of next in
package.json
to6.0.0-canary.6
then runyarn
andyarn dev
again - Navigate to
localhost:3000
and get the following error:
Context
Was wanting to test the new _app.js
functionality to see if it makes using getInitialProps
to load Apollo queries easier to use for pages implemented in ReasonML. Currently it’s difficult/impossible to bind to the static getInitialProps
from Reason pages.
Your Environment
Tech | Version |
---|---|
next | 6.0.0-canary.6 |
node | 9.4.0 |
OS | MacOS 10.13.4 |
browser | Chrome v65 |
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
with-reasonml example - state variables not persisting in ...
cache, we've written a custom webpack plugin that changes this behavior to share module instances between pages." Is that related at all to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Enalmada
I was able to get context in getInitialProps in a pure ReasonML page following the instructions here: https://github.com/zeit/next.js/pull/4217#issuecomment-385228035
Here is an example of accessing the context to detect if we are rendering on the server and passing a boolean into your ReasonReact component. Hope this helps!
HI @Enalmada I looked at that other issue and not enough time right now to test the hypothesis but maybe it would work if you define a mutable
ref()
, feed that to initial state, then mutate it (using:=
) in the reducer? Or maybe use a handler instead to mutate the counter variable inCounter.re
external to the state? Hope this gives you some things to try.https://reasonml.github.io/docs/en/mutation https://reasonml.github.io/reason-react/docs/en/react-ref (note this may be confusing since it is talking about react ref to get a reference to the DOM but it also uses a normal ocaml
ref()
and shows the use of handlers) https://reasonml.github.io/reason-react/docs/en/callback-handlers