Local Storage

Use of localStorage and SSR

Preferr makes extensive use of localStorage in order to recognize your component on a visitor's page and to identify visitors.

This pattern was chosen to eliminate the need for extra network requests that would be needed to determine which variant of an A/B test to render. The possibilty of a failed network request and the additional time necessary to process such a request would result in a possibly lengthy delay.

If you plan to use SSR with React, you may run into trouble because window and localStorage are not available at the time when your React files are run and rendered.

While we'd like to be able to fully support SSR, at this time there no plans to change the library to accommodate it.