小编Ari*_*ter的帖子

如何设置React Fiber的"类型"?

我有一个自定义的React Fiber Reconciler,我使用react-reconciler包中的默认导出创建.在ReactDOM组件中,我执行

this.mountNode = CustomRenderer.createContainer(this.stage)
CustomRenderer.updateContainer(
  <SomeContextProvider>{children}<SomeContextProvider/>,
  this.mountNode,
  this
)
Run Code Online (Sandbox Code Playgroud)

但是,当我打开React devtools时,我明白了

Uncaught TypeError: Cannot read property 'replace' of null  in the getDataFiber method here:
    case HostComponent:
        nodeType = 'Native';
        name = fiber.type;

        // TODO (bvaughn) we plan to remove this prefix anyway.
        // We can cut this special case out when it's gone.
        name = name.replace('topsecret-', ''); /////////// Error here on this line 
Run Code Online (Sandbox Code Playgroud)

这似乎是因为fiber.type是null.搜索周围,我看到人们将一个类型作为第二个参数传递给他们的渲染器的createContainer,但这样做会给我一个奇怪的,看似无关的错误

Uncaught TypeError: scheduleDeferredCallback is not a function
Uncaught TypeError: cancelDeferredCallback …
Run Code Online (Sandbox Code Playgroud)

reactjs react-fiber

8
推荐指数
0
解决办法
321
查看次数

文本文件只读奇数或偶数行?

我正在尝试编写一个从文本文件中读取的C#程序,并允许您选择要打印的行.

出于某种原因,它只会打印1,3,5等行.

如果我改变写着位int chooseLine = Convert.ToInt32(input);int chooseLine = (int)Convert.ToInt64(input);,然后只打印偶数行(0,2,4,6等).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Steve
{
    public static int count = 0;
    public static String[] steveTalk;
    public static void Main()
    {
        using (StreamReader r = new StreamReader("Steve.txt"))
        {
            string line;
            while ((line = r.ReadLine()) != null)
            {
                count++;
            }
        }
        using (StreamReader sr = new StreamReader("Steve.txt"))
        {
            int i = 0;
            steveTalk = new String[count];
            String line;
            while ((line = …
Run Code Online (Sandbox Code Playgroud)

c# file-io

3
推荐指数
1
解决办法
2482
查看次数

标签 统计

c# ×1

file-io ×1

react-fiber ×1

reactjs ×1