question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Working with NextJS

See original GitHub issue

Hey,

I’m looking how to I can use this wonderfull package with NextJS and especially with SSR.

I’m using userIdentifier like you said, but if I force the local value to A test, it renders B test and update the local value to B value instead of keeping A value.

Any idea how I can manage this ?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
YoannDelpierrecommented, Sep 27, 2019

Hi @moretti , yes it’s ok. I misunderstood how it works form react-ab-test point of view.

It’s totally cool right now.

Thanks

0reactions
YoannDelpierrecommented, Oct 26, 2020

@joselevelsup @lpanjwani Nothing special, I just put the userIdentifier as props in Experiment component

<Experiment name={EXPERIMENT_RANGE_NAME} userIdentifier={userId}>
<Variant name={EXPERIMENT_RANGE_VARIATIONS.WITH}>xxx</VARIANT>
<Variant name={EXPERIMENT_RANGE_VARIATIONS.WITHOUT}>yyy</VARIANT>
</Experiment>

And I used

useEffect(() => {
    emitter.defineVariants(EXPERIMENT_RANGE_NAME, [
      EXPERIMENT_RANGE_VARIATIONS.WITH,
      EXPERIMENT_RANGE_VARIATIONS.WITHOUT
    ]);
    emitter.calculateActiveVariant(EXPERIMENT_RANGE_NAME);
}, [])
Read more comments on GitHub >

github_iconTop Results From Across the Web

How Next.js Works | Learn Next.js
Create a Next.js App · Navigate Between Pages · Assets, Metadata, and CSS · Pre-rendering and Data Fetching · Dynamic Routes · API...
Read more >
The Next.js Handbook – Learn Next.js for Beginners
I wrote this tutorial to help you quickly learn Next.js and get familiar with how it works. It's ideal for you if you...
Read more >
What is Next.js used for? Introduction to Next.js for CTOs
Next.js is a JavaScript framework that provides an out-of-the-box solution for server side rendering (SSR) of React components. It works with ...
Read more >
What is Next.js & Why & How To Use It in 2022? - Emizentech
It depends. Next.js can be considered a full-stack that supports both frontend (react) and backend code (rest, MongoDB, node, react).
Read more >
next.js - Module Federation or Micro Frontend is not working in ...
Installing nextjs-mf ⚠️ Attention: for the application to work with Module Federation features you need to have access to the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found