SolidJSS
SolidJSβ€’3y agoβ€’
7 replies
Je Suis Un Ami

props.children is not defined.

I have this component.
const AuthProvider: Component<AuthContextProps> = (props) => {
  /// the local store.
  const [tokenStorage, setTokenStorage] = createLocalStorage({
    api: localStorage,
    prefix: "vista-auth-",
    deserializer: (data) => {
      if (!data || data == "undefined") {
        return "";
      }
      return data;
    },
    serializer: (value, key, options) => {
      return value;
    },
  });
  const [auth, setAuth] = createStore({
    access: tokenStorage.access,
    refresh: tokenStorage.refresh,
    get authenticated(): boolean {
      const hasAccess = this.access.length > 0;
      const hasRefresh = this.refresh.length > 0;
      return hasAccess || hasRefresh;
    },
  } as AuthState);

  return (
    <AuthContext.Provider value={auth}>
        {props.children!}
    </AuthContext.Provider>
  );
};

My IDE is telling me that props.children isn't defined somehow. I'm guessing this is just some typing problem? How would I fix this?
Was this page helpful?