quantizor / buttermilk

beautifully simple isomorphic routing for React projects
https://buttermilk.js.org/
MIT License
110 stars 6 forks source link

Child of Link component can't be React element anymore in v2.0.0 #18

Open andrekovac opened 5 years ago

andrekovac commented 5 years ago

The following code worked in buttermilk@1.1.2 but does not work in buttermilk@2.0.0 anymore:

import { Link } from 'buttermilk';
// ...

<Link href="/">
  <span>Home</span>
</Link>

Now no error is thrown, but it just doesn't link. Nothing happens when it actually should route to /.

When debugging I found that the <Link /> component only works if it's child is a string, e.g. <Link href="/">Home</Link>.

I saw you didn't change cjs.js in your v2.0.0. update, but something must have changed which influences this..

quantizor commented 4 years ago

Hmm. Can you make a codesandbox reproduction for this? Sorry for the late response.

ayebear commented 3 years ago

I reproduced this same issue in 2.0.1 here: https://codesandbox.io/s/modest-robinson-tm1iy

You can also try changing buttermilk back to 1.1.2 in codesandbox, which fixes the issue. In the codesandbox browser view it looks like it's pushing the actual route to history but not rendering anything new. Hope you can get this fixed.