Skip to content

I don't see the default variant #13

Description

@tonivuc

Hi!

Thanks for making this lib! I tried to use this but the experiment doesn't render.

My experiment file abtest.js looks like this:

import React from 'react';
import { Experiment, Variant } from 'react-google-optimize';

export default () => (
    <Experiment name="Test programtically changing component">
        <Variant default id="0">
           <p>Presenting variant 0!</p>
        </Variant>
        <Variant id="1">
           <p>Variant 1 everyone!</p>
        </Variant>
    </Experiment>
);

Included it like this:

import Abtest from './abtest';

...
some component code
...

render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} height="400px" max-width="40%" alt="logo"
            onClick={() => imageClicked()} />
          <Container>
            <Abtest></Abtest>
          </Container>
          <Segment className="bottommargin">
            <h1>Vil du bli med som alpha-tester?</h1>
            <EmailForm/>
          </Segment>
        </header>
      </div >
    )
 }

Everything except for <Abtest></Abtest> renders.

I get no compilation or clientside console errors.

I do get this tooltip from Visual Studio:

Could not find a declaration file for module 'react-google-optimize'. 'c:/Code/FilmTing/filmting/node_modules/react-google-optimize/build/react-google-optimize.js' implicitly has an 'any' type.
Try npm install @types/react-google-optimize if it exists or add a new declaration (.d.ts) file containing declare module 'react-google-optimize';

I got a warning that the sister dependency TypeScript was missing during installation, so added that via npm and ran the installation of react-google-optmize again. Google Optimize is included via a script tag in public/index.html.

Any idea how I can proceed to get it working?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions