Skip to content

Next.js runtime error #84

Description

@Chandler-Zhu

I tried to use splitting in my next.js app, but it gives me an error

import React, { useState, useRef, useEffect } from 'react'

import 'splitting/dist/splitting.css'
import 'splitting/dist/splitting-cells.css'
import Splitting from 'splitting'


export const SomePage = () => {

  const slideRef = useRef(null)

  useEffect(() => {
    // double checking we actually have a reference (and the value is not null)
    if (slideRef) {
     slideRef.current.Splitting();
    }
  }, [slideRef])

  return (
    <p
      ref={slideRef}
      data-splitting='true'
    >
      split some text here
    </p>
  )
}

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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