How to use the react-tweek.prepareKey function in react-tweek

To help you get started, we’ve selected a few react-tweek examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Soluto / tweek / services / editor / src / contexts / Tweek.js View on Github external
import React, { useEffect, useState } from 'react';
import { prepareKey, TweekProvider as OriginalTweekProvider } from 'react-tweek';
import { TweekRepository } from 'tweek-local-cache';
import { equals } from 'ramda';
import { tweekClient } from '../utils/tweekClients';
import { useCurrentUser } from './CurrentUser';

prepareKey('@tweek/editor/_');

const toTweekContext = ({ User }) => ({ tweek_editor_user: User });

export const TweekProvider = ({ children }) => {
  const [tweekRepository, setTweekRepository] = useState();

  const user = useCurrentUser();

  useEffect(() => {
    if (!user) {
      return;
    }

    const context = toTweekContext(user);

    if (tweekRepository) {

react-tweek

react bindings for tweek

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages