Error while using Roact-Rodux

Help Needed: Roact & RoactRodux Error - “Unknown ElementKind ‘nil’”

Hi everyone,

I’m encountering an issue with my Roact and RoactRodux setup and would appreciate any help or insights you might have. Here’s a summary of the problem:

Error Message:

ReplicatedStorage.Roact.createReconciler:444: Unknown ElementKind "nil"

Description:

I’m using Roact for UI components and RoactRodux for state management. My setup involves creating a StoreProvider component to provide the Redux store to child components. However, I’m receiving the “Unknown ElementKind ‘nil’” error during runtime.

Relevant Code:

  1. StoreProvider Component:

    local Roact = require(script.Parent.Parent.Roact)
    local storeKey = require(script.Parent.storeKey)
    
    local StoreProvider = Roact.Component:extend("StoreProvider")
    
    function StoreProvider:init(props)
        local store = props.store
    
        if store == nil then
            error("Error initializing StoreProvider. Expected a `store` prop to be a Rodux store.")
        end
    
        self._context[storeKey] = store
    end
    
    function StoreProvider:render()
        return Roact.oneChild(self.props[Roact.Children])
    end
    
    return StoreProvider
    
  2. Init.lua Script:

    local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local Roact = require(ReplicatedStorage:WaitForChild("Roact"))
    local RoactRodux = require(ReplicatedStorage:WaitForChild("RoactRodux"))
    local StoreModule = require(ReplicatedStorage:WaitForChild("Store"):WaitForChild("StoreModule"))
    
    local HelloWorldClient = require(script:WaitForChild("HelloWorldClient"))
    
    local StoreProvider = RoactRodux.StoreProvider
    local store = StoreModule.store
    
    if not store then
        error("Store is nil or invalid")
    end
    
    local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
    if not playerGui then
        error("PlayerGui is nil")
    end
    
    local provider = Roact.createElement(StoreProvider, {
        store = store
    }, {
        HelloWorld = Roact.createElement(HelloWorldClient)
    })
    
    Roact.mount(provider, playerGui, "HelloWorldGui")
    

What I’ve Tried:

  1. Verified that storeKey is properly defined and imported.
  2. Added debug prints to ensure StoreProvider and its store prop are initialized correctly.
  3. Checked that all components are defined and do not contain errors.

Questions:

  1. What could cause the “Unknown ElementKind ‘nil’” error in createReconciler?
  2. Are there any common issues with StoreProvider that could lead to this error?
  3. How can I further debug this issue to identify the root cause?

Any help or guidance would be greatly appreciated! Thanks in advance. :blush:

This is probably why it doesn’t work. You need to require it.

local StoreProvider = require(ReplicatedStorage.StoreProvider)
1 Like

I found the Solution after asking the Roblox OSS community, apparently the problem was that HelloWorldClient wasn’t a Module and I didn’t require it.

so now it’s fixed but thanks for the help ^^

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.